From 8ea87c22439932a137f75e88051db0980e3d7159 Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Mon, 24 Feb 2020 15:44:54 +0100 Subject: [PATCH] Move system-tests to main .spec Change-Id: I675555baab83ce3051401757054bde3cf4317271 --- CMakeLists.txt | 2 +- packaging/crash-worker.manifest | 20 +++++ packaging/crash-worker.spec | 71 +++++++++++++--- packaging/crash-worker_system-tests.manifest | 26 ------ packaging/crash-worker_system-tests.spec | 95 ---------------------- tests/CMakeLists.txt | 2 + tests/system/CMakeLists.txt | 6 +- tests/system/so_info_file/so_info_file.sh.template | 2 +- tests/system/utils/CMakeLists.txt | 3 +- 9 files changed, 90 insertions(+), 137 deletions(-) delete mode 100644 packaging/crash-worker_system-tests.manifest delete mode 100644 packaging/crash-worker_system-tests.spec diff --git a/CMakeLists.txt b/CMakeLists.txt index cf0df7b..e7579d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1) # Sub modules ADD_SUBDIRECTORY(include) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/crash-service) ADD_SUBDIRECTORY(src/crash-manager) ADD_SUBDIRECTORY(src/crash-stack) diff --git a/packaging/crash-worker.manifest b/packaging/crash-worker.manifest index 25bee3e..1ed60c3 100644 --- a/packaging/crash-worker.manifest +++ b/packaging/crash-worker.manifest @@ -5,5 +5,25 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/crash-worker.spec b/packaging/crash-worker.spec index 65afbef..07c2027 100644 --- a/packaging/crash-worker.spec +++ b/packaging/crash-worker.spec @@ -82,6 +82,19 @@ Summary: Livedumper allows to dump core of live process %description livedumper %endif +%package system-tests +Summary: System tests for crash-worker components +Requires: diff +Requires: gdb +Requires: coreutils +Requires: tlm +Requires: /bin/bash +Requires: /usr/bin/unzip +Requires: /usr/bin/mcookie +Requires: %{_sbindir}/minicoredumper +Requires: %{name}-system-tests-debuginfo = %{version}-%{release} +%description system-tests + %prep %setup -q @@ -130,7 +143,8 @@ export CFLAGS+=" -Werror" -DCRASH_STACK_BIN_PATH=%{_libexecdir}/crash-stack \ -DCRASH_POPUP_BIN_PATH=%{_libexecdir}/crash-popup-launch \ -DCRASH_NOTIFY_BIN_PATH=%{_libexecdir}/crash-notify-send \ - -DCRASH_TESTS_PATH=%{_libdir}/crash-worker-tests \ + -DCRASH_TESTS_PATH=%{_libdir}/crash-worker/tests \ + -DCRASH_SYSTEM_TESTS_PATH=%{_libdir}/crash-worker/system-tests \ -DLIVEDUMPER=%{on_off livedumper} \ -DCRASH_SERVICE=%{on_off crashservice} \ -DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \ @@ -138,6 +152,7 @@ export CFLAGS+=" -Werror" -DVERSION=%{version} make %{?jobs:-j%jobs} + %if %{with doc} make doc %endif @@ -206,15 +221,15 @@ mkdir -p %{buildroot}%{crash_temp} %files tests %manifest %{name}.manifest %defattr(-,root,root) -%{_libdir}/crash-worker-tests/test1-default-crash -%{_libdir}/crash-worker-tests/test1-default-sleep -%{_libdir}/crash-worker-tests/test1-default-ill -%{_libdir}/crash-worker-tests/test1-custom-crash -%{_libdir}/crash-worker-tests/test1-custom-sleep -%{_libdir}/crash-worker-tests/test1-custom-ill -%{_libdir}/crash-worker-tests/run_tests.sh -%{_libdir}/crash-worker-tests/tests_common.sh -%{_libdir}/crash-worker-tests/crash_common.sh +%{_libdir}/crash-worker/tests/test1-default-crash +%{_libdir}/crash-worker/tests/test1-default-sleep +%{_libdir}/crash-worker/tests/test1-default-ill +%{_libdir}/crash-worker/tests/test1-custom-crash +%{_libdir}/crash-worker/tests/test1-custom-sleep +%{_libdir}/crash-worker/tests/test1-custom-ill +%{_libdir}/crash-worker/tests/run_tests.sh +%{_libdir}/crash-worker/tests/tests_common.sh +%{_libdir}/crash-worker/tests/crash_common.sh %endif @@ -223,3 +238,39 @@ mkdir -p %{buildroot}%{crash_temp} %manifest %{name}.manifest %{_bindir}/livedumper %endif + +%files system-tests +%manifest %{name}.manifest +%{_bindir}/crash-worker-system-tests-run + +%{_libdir}/crash-worker/system-tests/check_minicore_mem/check_minicore_mem.sh +%{_libdir}/crash-worker/system-tests/check_minicore_mem/cp.sh +%{_libdir}/crash-worker/system-tests/cmp_backtraces/cmp_backtraces.sh +%{_libdir}/crash-worker/system-tests/cmp_backtraces/cp.sh +%{_libdir}/crash-worker/system-tests/crash_root_path/crash_root_path.sh +%{_libdir}/crash-worker/system-tests/critical_process/critical_process.sh +%{_libdir}/crash-worker/system-tests/dbus_notify/dbus_notify.sh +%{_libdir}/crash-worker/system-tests/dbus_notify_legacy/dbus_notify_legacy.sh +%{_libdir}/crash-worker/system-tests/dump_systemstate_extras/dump_systemstate_extras.sh +%{_libdir}/crash-worker/system-tests/exclude_paths/exclude_paths.sh +%{_libdir}/crash-worker/system-tests/extra_script/extra_script.sh +%{_libdir}/crash-worker/system-tests/full_core/full_core.sh +%{_libdir}/crash-worker/system-tests/info_file/info_file.sh +%{_libdir}/crash-worker/system-tests/libcrash-service/libcrash-service.sh +%{_libdir}/crash-worker/system-tests/log_file/log_file.sh +%{_libdir}/crash-worker/system-tests/output_param/output_param.sh +%{_libdir}/crash-worker/system-tests/report_basic/report_basic.sh +%{_libdir}/crash-worker/system-tests/report_type_info/report_type_info.sh +%{_libdir}/crash-worker/system-tests/so_info_file/so_info_file.sh +%{_libdir}/crash-worker/system-tests/time_test/cp.sh +%{_libdir}/crash-worker/system-tests/time_test/time_test.sh +%{_libdir}/crash-worker/system-tests/utils/btee +%{_libdir}/crash-worker/system-tests/utils/kenny +%{_libdir}/crash-worker/system-tests/utils/libcrash-servicetest +%{_libdir}/crash-worker/system-tests/utils/minicore-utils.sh +%{_libdir}/crash-worker/system-tests/wait_for_opt_usr/wait_for_opt_usr.sh +%{_libdir}/crash-worker/system-tests/without_core/without_core.sh + +%if %{with livedumper} +%{_libdir}/crash-worker/system-tests/livedumper/livedumper.sh +%endif diff --git a/packaging/crash-worker_system-tests.manifest b/packaging/crash-worker_system-tests.manifest deleted file mode 100644 index 83fdab3..0000000 --- a/packaging/crash-worker_system-tests.manifest +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/crash-worker_system-tests.spec b/packaging/crash-worker_system-tests.spec deleted file mode 100644 index 8e1061e..0000000 --- a/packaging/crash-worker_system-tests.spec +++ /dev/null @@ -1,95 +0,0 @@ -%global __debug_package 1 -# because of this is debug package, there are source files (kenny.cpp and -# btee.c) that will be copied to the destination directory, but we don't want -# them in the rpm package so this flag is to avoid RPM build error: -%define _unpackaged_files_terminate_build 0 -%define _with_livedumper on -%bcond_with livedumper - -Name: crash-worker_system-tests -Summary: Package with binaries and scripts for crash-worker system tests -Version: 6.0.11 -Release: 1 -Group: Framework/system -License: Apache-2.0 and BSD -Source0: %{name}-%{version}.tar.gz -Source1001: crash-worker_system-tests.manifest -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(rpm) -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(crash-service) -BuildRequires: cmake - -Requires: diff -Requires: gdb -Requires: coreutils -Requires: tlm -Requires: /bin/bash -Requires: /usr/bin/unzip -Requires: /usr/bin/mcookie -Requires: crash-worker -Requires: libcrash-service -Requires: %{_sbindir}/minicoredumper - -%description -This package contains installable tests in Bash. - -%prep -%setup -q - - -%build -cp %{SOURCE1001} . - -export CFLAGS+=" -Werror" - -cd tests/system -%cmake . -DCRASH_SYSTEM_TESTS_PATH=%{_libdir}/crash-worker_system-tests - -make %{?jobs:-j%jobs} - -%install -rm -rf %{buildroot} -cd tests/system -%make_install - -%files -f debugfiles.list -%manifest %{name}.manifest -%defattr(0750,system_fw,system_fw) -%{_libdir}/crash-worker_system-tests/full_core/full_core.sh -%{_libdir}/crash-worker_system-tests/check_minicore_mem/check_minicore_mem.sh -%{_libdir}/crash-worker_system-tests/check_minicore_mem/cp.sh -%{_libdir}/crash-worker_system-tests/cmp_backtraces/cmp_backtraces.sh -%{_libdir}/crash-worker_system-tests/cmp_backtraces/cp.sh -%{_libdir}/crash-worker_system-tests/crash_root_path/crash_root_path.sh -%{_libdir}/crash-worker_system-tests/critical_process/critical_process.sh -%{_libdir}/crash-worker_system-tests/dbus_notify/dbus_notify.sh -%{_libdir}/crash-worker_system-tests/dbus_notify_legacy/dbus_notify_legacy.sh -%{_libdir}/crash-worker_system-tests/dump_systemstate_extras/dump_systemstate_extras.sh -%{_libdir}/crash-worker_system-tests/exclude_paths/exclude_paths.sh -%{_libdir}/crash-worker_system-tests/extra_script/extra_script.sh -%{_libdir}/crash-worker_system-tests/info_file/info_file.sh -%{_libdir}/crash-worker_system-tests/log_file/log_file.sh -%{_libdir}/crash-worker_system-tests/report_basic/report_basic.sh -%{_libdir}/crash-worker_system-tests/report_type_info/report_type_info.sh -%{_libdir}/crash-worker_system-tests/run.sh -%{_libdir}/crash-worker_system-tests/so_info_file/so_info_file.sh -%{_libdir}/crash-worker_system-tests/time_test/cp.sh -%{_libdir}/crash-worker_system-tests/time_test/time_test.sh -%{_libdir}/crash-worker_system-tests/utils/btee -%{_libdir}/crash-worker_system-tests/utils/kenny -%{_libdir}/crash-worker_system-tests/utils/libcrash-servicetest -%{_libdir}/crash-worker_system-tests/utils/minicore-utils.sh -%{_libdir}/crash-worker_system-tests/wait_for_opt_usr/wait_for_opt_usr.sh -%{_libdir}/crash-worker_system-tests/without_core/without_core.sh -%{_libdir}/crash-worker_system-tests/output_param/output_param.sh -%{_libdir}/crash-worker_system-tests/libcrash-service/libcrash-service.sh -%if %{with livedumper} -%{_libdir}/crash-worker_system-tests/livedumper/livedumper.sh -%endif -%defattr(-,root,root) - -# %post -# /usr/bin/chsmack -a "_" -e "SSSystem::Privileged" -r %{_libdir}/crash-worker_system-tests/ - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6c4d658..2c5baf5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 2.8.12) +add_subdirectory(system) + # tests INCLUDE(FindPkgConfig) diff --git a/tests/system/CMakeLists.txt b/tests/system/CMakeLists.txt index 90c698e..eace3ef 100644 --- a/tests/system/CMakeLists.txt +++ b/tests/system/CMakeLists.txt @@ -4,7 +4,8 @@ ADD_SUBDIRECTORY(utils) macro(CONFIGURE_TEST_FILE dir_name file_name) configure_file("${dir_name}/${file_name}.sh.template" "${dir_name}/${file_name}.sh" @ONLY) - INSTALL(DIRECTORY ${dir_name}/ DESTINATION ${CRASH_SYSTEM_TESTS_PATH}/${dir_name} FILES_MATCHING PATTERN "*sh") + INSTALL(DIRECTORY ${dir_name}/ DESTINATION ${CRASH_SYSTEM_TESTS_PATH}/${dir_name} FILES_MATCHING PATTERN "*sh" + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endmacro() macro(CONFIGURE_TEST test_name) @@ -39,4 +40,5 @@ configure_test("libcrash-service") configure_test("full_core") configure_file("run.sh.template" "run.sh" @ONLY) -INSTALL(FILES run.sh DESTINATION ${CRASH_SYSTEM_TESTS_PATH}) +INSTALL(FILES "run.sh" DESTINATION bin RENAME crash-worker-system-tests-run + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) diff --git a/tests/system/so_info_file/so_info_file.sh.template b/tests/system/so_info_file/so_info_file.sh.template index d8437ac..23cd7d9 100644 --- a/tests/system/so_info_file/so_info_file.sh.template +++ b/tests/system/so_info_file/so_info_file.sh.template @@ -35,7 +35,7 @@ popd RESULT=$(cat ${CRASH_DUMP_PATH}/${REPORT_DIR}/${REPORT_DIR}.so_info) -check "utils/kenny [a-z0-9]+ crash-worker_system-tests;[^;]+;[^;]+;[a-z0-9]+" +check "utils/kenny [a-z0-9]+ crash-worker-system-tests;[^;]+;[^;]+;[a-z0-9]+" check "/usr/lib/libm[^ ]+ [a-z0-9]+ glibc;[^;]+;[^;]+;[a-z0-9]+" check "/usr/lib/libc[^ ]+ [a-z0-9]+ glibc;[^;]+;[^;]+;[a-z0-9]+" check "/usr/lib/libgcc_s[^ ]+ [a-z0-9]+ libgcc;[^;]+;[^;]+;[a-z0-9]+" diff --git a/tests/system/utils/CMakeLists.txt b/tests/system/utils/CMakeLists.txt index 5bd6710..0d2bbe4 100644 --- a/tests/system/utils/CMakeLists.txt +++ b/tests/system/utils/CMakeLists.txt @@ -12,11 +12,10 @@ add_executable(libcrash-servicetest libcrash-servicetest.c) INCLUDE(FindPkgConfig) pkg_check_modules(helper_pkgs REQUIRED - crash-service gio-2.0 dlog) -TARGET_LINK_LIBRARIES(libcrash-servicetest crash-service ${helper_pkgs_LDFLAGS}) +TARGET_LINK_LIBRARIES(libcrash-servicetest libcrash-service ${helper_pkgs_LDFLAGS}) install(TARGETS kenny DESTINATION ${CRASH_SYSTEM_TESTS_PATH}/utils) install(TARGETS btee DESTINATION ${CRASH_SYSTEM_TESTS_PATH}/utils) -- 2.7.4