ACLOCAL_AMFLAGS='-I m4'
SUBDIRS = src test
+if IS_TESTS
+SUBDIRS += unittest
+endif
pcfiles = mm-streamrecorder.pc
pkgconfigdir = $(libdir)/pkgconfig
# Checks for programs.
AC_PROG_CC
+AC_PROG_CXX
AC_C_CONST
dnl AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_HEADER_TIME
AC_PROG_GCC_TRADITIONAL
AC_PROG_LIBTOOL
+AC_SUBST(GCC_CXXFLAGS)
# Checks for libraries.
PKG_CHECK_MODULES(GST, gstreamer-1.0 >= 1.2.0)
AC_SUBST(INIPARSER_CFLAGS)
AC_SUBST(INIPARSER_LIBS)
+AC_ARG_ENABLE(tests, AC_HELP_STRING([--enable-tests], [unittest build]),
+ [
+ case "${enableval}" in
+ yes) IS_TESTS=yes ;;
+ no) IS_TESTS=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
+ esac
+ ],
+[IS_TESTS=no])
+AM_CONDITIONAL([IS_TESTS], [test "x$IS_TESTS" = "xyes"])
+
+AS_IF([test "x$enable_tests" = "xyes"], [
+ PKG_CHECK_MODULES(GTESTS, gmock)
+ AC_SUBST(GTESTS_CFLAGS)
+ AC_SUBST(GTESTS_LIBS)
+])
+
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h memory.h stdlib.h string.h sys/time.h unistd.h])
Makefile
src/Makefile
test/Makefile
+unittest/Makefile
mm-streamrecorder.pc
])
AC_OUTPUT
Name: libmm-streamrecorder
Summary: Media Stream Recorder library
-Version: 0.0.19
+Version: 0.0.20
Release: 0
Group: Multimedia/Other
License: Apache-2.0
BuildRequires: pkgconfig(gstreamer-video-1.0)
BuildRequires: pkgconfig(gstreamer-app-1.0)
BuildRequires: pkgconfig(iniparser)
+%if 0%{?gtests:1}
+BuildRequires: pkgconfig(gmock)
+%endif
%description
This library is for making video/audio files with gstreamer
export CFLAGS+=" -Wall -Wextra -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wno-unused-parameter -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-but-set-parameter -Wno-unused-but-set-variable"
export CFLAGS+=" -DSYSCONFDIR=\\\"%{_sysconfdir}\\\""
./autogen.sh
-%configure --disable-static
+%configure \
+%if 0%{?gtests:1}
+--enable-tests \
+%endif
+--disable-static
+
make %{?jobs:-j%jobs}
%install
%defattr(-,root,root,-)
%{_bindir}/*
%{_libdir}/*.so.*
+%if 0%{?gtests:1}
+%{_bindir}/gtest-libmm-streamrecorder
+%endif
%files devel
--- /dev/null
+bin_PROGRAMS = gtest-libmm-streamrecorder
+
+gtest_libmm_streamrecorder_SOURCES = libmm_streamrecorder_unittest.cpp
+
+gtest_libmm_streamrecorder_CXXFLAGS = -I$(top_srcdir)/src/include \
+ $(GTESTS_CFLAGS)
+
+gtest_libmm_streamrecorder_DEPENDENCIES = $(top_srcdir)/src/libmmfstreamrecorder.la
+
+gtest_libmm_streamrecorder_LDADD = \
+ $(GTESTS_LIBS) \
+ $(top_srcdir)/src/libmmfstreamrecorder.la
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include "libmm_streamrecorder_unittest.h"
+
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+
+class libmm_streamrecorder_Test : public ::testing::Test {
+ protected:
+ void SetUp() {
+ std::cout << "SetUp()" << std::endl;
+ }
+
+ void TearDown() {
+ std::cout << "TearDown()" << std::endl;
+ }
+};
+
+TEST(libmm_streamrecorderTest, __srecorder_get_fourcc_p1)
+{
+ EXPECT_EQ(1, 1);
+}
+
+int main(int argc, char **argv)
+{
+ InitGoogleTest(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LIB_MM_STREAMRECORDER_UNITTEST_H__
+#define __LIB_MM_STREAMRECORDER_UNITTEST_H__
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#undef LOG_TAG
+#define LOG_TAG "GTEST_LIBMM_STREAMRECORDER"
+
+#endif /*__LIB_MM_STREAMRECORDER_UNITTEST_H__*/