From c573cdb26d3d78d6d794d3646b840b0f825dd53f Mon Sep 17 00:00:00 2001 From: "jabber.developer2" Date: Thu, 22 Jan 2026 16:55:04 +0300 Subject: [PATCH] fix: improve functional test stability and CI reliability - Fix parallel test execution conflicts by moving test files to build dir - Improve error handling in ci-build.sh with proper exit codes - Update test file paths for out-of-tree build compatibility - Add test-files and test-logs to .gitignore - Add clean-functional-tests target to Makefile.am --- .gitignore | 2 ++ Makefile.am | 7 +++++-- ci-build.sh | 16 +++++++++++++--- tests/functionaltests/proftest.c | 7 ++++--- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 47deffd6..6ba4eb62 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,8 @@ tests/unittests/unittests tests/unittests/unittests.log tests/unittests/unittests.trs test-suite.log +test-files/ +test-logs/ # valgrind output profval* diff --git a/Makefile.am b/Makefile.am index 89809594..9fbe9132 100644 --- a/Makefile.am +++ b/Makefile.am @@ -313,7 +313,7 @@ FUNC_TEST_GROUPS = 1 2 3 4 check-functional-parallel: tests/functionaltests/functionaltests @echo "Running functional tests in parallel ($(words $(FUNC_TEST_GROUPS)) groups)..." - @mkdir -p $(builddir)/test-logs + @mkdir -p $(builddir)/test-logs $(builddir)/test-files @pids=""; \ for g in $(FUNC_TEST_GROUPS); do \ ./tests/functionaltests/functionaltests $$g > $(builddir)/test-logs/group$$g.log 2>&1 & \ @@ -372,7 +372,10 @@ clean-local: rm -f $(git_include) $(git_include).in endif -.PHONY: my-prof.supp +clean-functional-tests: + rm -rf $(builddir)/test-files $(builddir)/test-logs + +.PHONY: my-prof.supp clean-functional-tests my-prof.supp: @sed '/^# AUTO-GENERATED START/q' prof.supp > $@ @printf "\n\n# glib\n" >> $@ diff --git a/ci-build.sh b/ci-build.sh index f98bedfa..b240df0b 100755 --- a/ci-build.sh +++ b/ci-build.sh @@ -215,10 +215,20 @@ build_and_test() { cd "$build_dir" # shellcheck disable=SC2086 - ../configure -C $features $extra_args + if ! ../configure -C $features $extra_args; then + echo "ERROR: configure failed" + exit 1 + fi - $MAKE CC="${CC}" - $MAKE check-functional-parallel + if ! $MAKE CC="${CC}"; then + echo "ERROR: make failed" + exit 1 + fi + + if ! $MAKE check-functional-parallel; then + echo "ERROR: functional tests failed" + exit 1 + fi ./profanity -v $MAKE clean diff --git a/tests/functionaltests/proftest.c b/tests/functionaltests/proftest.c index 4ece33d6..7f611f36 100644 --- a/tests/functionaltests/proftest.c +++ b/tests/functionaltests/proftest.c @@ -137,7 +137,7 @@ void _cleanup_dirs(void) { char cmd[512]; - snprintf(cmd, sizeof(cmd), "rm -rf ./tests/functionaltests/files/%d", stub_port); + snprintf(cmd, sizeof(cmd), "rm -rf ./test-files/%d", stub_port); int res = system(cmd); if (res == -1) { assert_true(FALSE); @@ -241,10 +241,11 @@ init_prof_test(void **state) } // Generate unique XDG paths based on stub_port for parallel execution + // Use ./test-files/ in current (build) directory for out-of-tree builds compatibility snprintf(xdg_config_home, sizeof(xdg_config_home), - "./tests/functionaltests/files/%d/xdg_config_home", stub_port); + "./test-files/%d/xdg_config_home", stub_port); snprintf(xdg_data_home, sizeof(xdg_data_home), - "./tests/functionaltests/files/%d/xdg_data_home", stub_port); + "./test-files/%d/xdg_data_home", stub_port); // Give stabber server thread time to start listening usleep(100000); // 100ms