fix: improve functional test stability and CI reliability
All checks were successful
CI Code / Check spelling (pull_request) Successful in 18s
CI Code / Check coding style (pull_request) Successful in 34s
CI Code / Code Coverage (pull_request) Successful in 15m26s
CI Code / Linux (ubuntu) (pull_request) Successful in 18m15s
CI Code / Linux (debian) (pull_request) Successful in 18m27s
CI Code / Linux (arch) (pull_request) Successful in 21m9s

- 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
This commit is contained in:
2026-01-22 16:55:04 +03:00
parent 6a25d178d5
commit c573cdb26d
4 changed files with 24 additions and 8 deletions

2
.gitignore vendored
View File

@@ -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*

View File

@@ -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" >> $@

View File

@@ -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

View File

@@ -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