From cfaab0d3e4b82dc86b9e91bf1c001e184990bc39 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 22 Dec 2022 15:44:16 +0900 Subject: [PATCH] add tbm-unittest package Change-Id: I609dfc35ea3ad853c29cf6f291be0ca4edf7f6df Signed-off-by: Junkyeong Kim --- haltests/Makefile.am | 31 ++++++++++++++++++++++++++++++- packaging/libtbm.spec | 25 ++++++++++++++++++++++++- packaging/run-unittest.sh | 20 ++++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 packaging/run-unittest.sh diff --git a/haltests/Makefile.am b/haltests/Makefile.am index beace9c..4f2be61 100644 --- a/haltests/Makefile.am +++ b/haltests/Makefile.am @@ -1,4 +1,5 @@ -bin_PROGRAMS = tbm-haltests +bin_PROGRAMS = tbm-haltests \ + tbm-unittests tbm_haltests_SOURCES = \ tc_main.cpp \ @@ -27,5 +28,33 @@ tbm_haltests_LDFLAGS = \ $(top_builddir)/src/libtbm.la \ -pthread +tbm_unittests_SOURCES = \ + tc_main.cpp \ + tc_tbm_env.cpp \ + tc_tbm_bufmgr.cpp \ + tc_tbm_bo.cpp \ + tc_tbm_surface.cpp \ + tc_tbm_surface_internal.cpp \ + tc_tbm_surface_queue.cpp \ + tc_tbm_backend.cpp \ + tc_tbm_log.cpp + +tbm_unittests_CXXFLAGS = \ + @DLOG_CFLAGS@ \ + ${CXXFLAGS} \ + @LIBTBM_CFLAGS@ \ + @LIBTBM_TEST_CFLAGS@ \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/src + +tbm_unittests_LDFLAGS = \ + @DLOG_LIBS@ \ + @LIBTBM_LIBS@ \ + @LIBTBM_TEST_LIBS@ \ + ${LDFLAGS} \ + $(top_builddir)/src/libtbm.la \ + -pthread + check: ./tbm-haltests + ./tbm-unittests diff --git a/packaging/libtbm.spec b/packaging/libtbm.spec index 5a9208c..f80e685 100644 --- a/packaging/libtbm.spec +++ b/packaging/libtbm.spec @@ -16,8 +16,9 @@ License: MIT Summary: The library for Tizen Buffer Manager Group: System/Libraries Source0: %{name}-%{version}.tar.gz -Source1001: %name.manifest +Source1001: %name.manifest Source1002: sw_sync.conf +Source1003: run-unittest.sh BuildRequires: pkgconfig(libdrm) BuildRequires: pkgconfig(wayland-server) @@ -59,6 +60,13 @@ Group: System/Libraries %description haltests Test module for testing libtbm APIs + +%package unittests +Summary: Tizen Buffer Manager unit tests package +Group: System/Libraries + +%description unittests +Test module for testing libtbm APIs %endif %global TZ_SYS_RO_SHARE %{?TZ_SYS_RO_SHARE:%TZ_SYS_RO_SHARE}%{!?TZ_SYS_RO_SHARE:/usr/share} @@ -111,6 +119,11 @@ mkdir -p "$gcno_obj_dir" find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';' %endif +%if "%{HALTESTS_PACKAGE}" == "1" +mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name} +install -m 0755 %SOURCE1003 %{buildroot}%{_bindir}/tizen-unittests/%{name}/ +%endif + %clean rm -rf %{buildroot} @@ -124,6 +137,11 @@ if [ -f %{_bindir}/tbm-haltests ]; then rm -f %{_bindir}/tbm-haltests fi ln -s %{_bindir}/hal/tbm-haltests %{_bindir}/tbm-haltests + +if [ -f %{_bindir}/tbm-unittests ]; then + rm -f %{_bindir}/tbm-unittests +fi +ln -s %{_bindir}/hal/tbm-unittests %{_bindir}/tbm-unittests %endif %postun -p /sbin/ldconfig @@ -150,6 +168,11 @@ rm -f %{_unitdir_user}/basic.target.wants/tbm-drm-auth-user.path %files haltests %defattr(-,root,root,-) %{_bindir}/hal/tbm-haltests + +%files unittests +%defattr(-,root,root,-) +%{_bindir}/hal/tbm-unittests +%{_bindir}/tizen-unittests/%{name}/run-unittest.sh %endif %if 0%{?gcov:1} diff --git a/packaging/run-unittest.sh b/packaging/run-unittest.sh new file mode 100644 index 0000000..f03b648 --- /dev/null +++ b/packaging/run-unittest.sh @@ -0,0 +1,20 @@ +#!/bin/sh +setup() { + echo "setup start" +} + +test_main() { + echo "test_main start" + /usr/bin/tbm-unittests +} + +teardown() { + echo "teardown start" +} + +main() { + setup + test_main + teardown +} + -- 2.7.4