Skip to content

Commit dec4471

Browse files
larsewiclaude
andcommitted
Reduced noise from cfbs shell test output
Ticket: ENT-12619 Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c665e1f commit dec4471

1 file changed

Lines changed: 101 additions & 48 deletions

File tree

tests/shell/all.sh

Lines changed: 101 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,108 @@
1+
#!/usr/bin/env bash
12
echo "Warning: These shell based tests use the cfbs you have installed"
23
echo " If you haven't already, run: pip install ."
34
set -e
4-
set -x
55
export CFBS_USER_AGENT=CI # this user agent will be excluded from the build modules statistics
66

7-
bash tests/shell/001_init.sh
8-
bash tests/shell/002_add.sh
9-
bash tests/shell/003_download.sh
10-
bash tests/shell/004_build.sh
11-
bash tests/shell/005_alias.sh
12-
bash tests/shell/006_search.sh
13-
bash tests/shell/007_install.sh
14-
bash tests/shell/008_remove.sh
15-
bash tests/shell/009_clean.sh
16-
bash tests/shell/010_local_add.sh
17-
bash tests/shell/011_update.sh
18-
bash tests/shell/012_prepend_dot_slash.sh
19-
bash tests/shell/013_add_url_commit.sh
20-
bash tests/shell/014_add_nonexistent.sh
21-
bash tests/shell/015_add_version.sh
22-
bash tests/shell/016_add_folders.sh
23-
bash tests/shell/017_info.sh
24-
bash tests/shell/018_update_input_one_variable.sh
25-
bash tests/shell/019_update_input_two_variables.sh
26-
bash tests/shell/020_update_input_list.sh
27-
bash tests/shell/021_update_input_list_with_keys.sh
28-
bash tests/shell/022_update_input_fail_variable.sh
29-
bash tests/shell/023_update_input_fail_number.sh
30-
bash tests/shell/024_update_input_fail_bundle.sh
31-
bash tests/shell/025_add_input_remove.sh
32-
bash tests/shell/026_init_no_masterfiles.sh
33-
bash tests/shell/027_init_masterfiles_version_master.sh
34-
bash tests/shell/028_init_masterfiles_version_3.18.2.sh
35-
bash tests/shell/029_init_masterfiles_version_3.18.1-1.sh
36-
bash tests/shell/030_get_set_input.sh
37-
bash tests/shell/031_get_set_input_pipe.sh
38-
bash tests/shell/032_set_input_unordered.sh
39-
bash tests/shell/033_add_commits_local_files.sh
40-
bash tests/shell/034_git_user_name_git_user_email.sh
41-
bash tests/shell/035_cfbs_build_compatibility_1.sh
42-
bash tests/shell/036_cfbs_build_compatibility_2.sh
43-
bash tests/shell/037_cfbs_validate.sh
44-
bash tests/shell/038_global_dir.sh
45-
bash tests/shell/039_add_added_by_field_update_1.sh
46-
bash tests/shell/040_add_added_by_field_update_2.sh
47-
bash tests/shell/041_add_multidep.sh
48-
bash tests/shell/042_update_from_url.sh
49-
bash tests/shell/043_replace_version.sh
50-
bash tests/shell/044_replace.sh
51-
bash tests/shell/045_update_from_url_branch_uptodate.sh
52-
bash tests/shell/046_update_from_url_branch.sh
53-
bash tests/shell/047_absolute_path_modules.sh
7+
_passed=0
8+
_failed=0
9+
_skipped=0
10+
_total=0
11+
_failures=""
12+
_suite_start=$(date +%s)
5413

14+
run_test() {
15+
local test_script="$1"
16+
local test_name
17+
test_name=$(basename "$test_script" .sh)
18+
_total=$((_total + 1))
19+
20+
local start end elapsed
21+
start=$(date +%s)
22+
23+
local output
24+
local exit_code=0
25+
output=$(bash "$test_script" 2>&1) || exit_code=$?
26+
27+
end=$(date +%s)
28+
elapsed=$((end - start))
29+
30+
if [ $exit_code -eq 0 ]; then
31+
if echo "$output" | grep -q "^--- SKIP:"; then
32+
_skipped=$((_skipped + 1))
33+
echo "--- SKIP: $test_name (${elapsed}s)"
34+
else
35+
_passed=$((_passed + 1))
36+
echo "--- PASS: $test_name (${elapsed}s)"
37+
fi
38+
else
39+
_failed=$((_failed + 1))
40+
_failures="${_failures} ${test_name}\n"
41+
echo "--- FAIL: $test_name (${elapsed}s)"
42+
echo "$output"
43+
echo "---"
44+
fi
45+
}
46+
47+
run_test tests/shell/001_init.sh
48+
run_test tests/shell/002_add.sh
49+
run_test tests/shell/003_download.sh
50+
run_test tests/shell/004_build.sh
51+
run_test tests/shell/005_alias.sh
52+
run_test tests/shell/006_search.sh
53+
run_test tests/shell/007_install.sh
54+
run_test tests/shell/008_remove.sh
55+
run_test tests/shell/009_clean.sh
56+
run_test tests/shell/010_local_add.sh
57+
run_test tests/shell/011_update.sh
58+
run_test tests/shell/012_prepend_dot_slash.sh
59+
run_test tests/shell/013_add_url_commit.sh
60+
run_test tests/shell/014_add_nonexistent.sh
61+
run_test tests/shell/015_add_version.sh
62+
run_test tests/shell/016_add_folders.sh
63+
run_test tests/shell/017_info.sh
64+
run_test tests/shell/018_update_input_one_variable.sh
65+
run_test tests/shell/019_update_input_two_variables.sh
66+
run_test tests/shell/020_update_input_list.sh
67+
run_test tests/shell/021_update_input_list_with_keys.sh
68+
run_test tests/shell/022_update_input_fail_variable.sh
69+
run_test tests/shell/023_update_input_fail_number.sh
70+
run_test tests/shell/024_update_input_fail_bundle.sh
71+
run_test tests/shell/025_add_input_remove.sh
72+
run_test tests/shell/026_init_no_masterfiles.sh
73+
run_test tests/shell/027_init_masterfiles_version_master.sh
74+
run_test tests/shell/028_init_masterfiles_version_3.18.2.sh
75+
run_test tests/shell/029_init_masterfiles_version_3.18.1-1.sh
76+
run_test tests/shell/030_get_set_input.sh
77+
run_test tests/shell/031_get_set_input_pipe.sh
78+
run_test tests/shell/032_set_input_unordered.sh
79+
run_test tests/shell/033_add_commits_local_files.sh
80+
run_test tests/shell/034_git_user_name_git_user_email.sh
81+
run_test tests/shell/035_cfbs_build_compatibility_1.sh
82+
run_test tests/shell/036_cfbs_build_compatibility_2.sh
83+
run_test tests/shell/037_cfbs_validate.sh
84+
run_test tests/shell/038_global_dir.sh
85+
run_test tests/shell/039_add_added_by_field_update_1.sh
86+
run_test tests/shell/040_add_added_by_field_update_2.sh
87+
run_test tests/shell/041_add_multidep.sh
88+
run_test tests/shell/042_update_from_url.sh
89+
run_test tests/shell/043_replace_version.sh
90+
run_test tests/shell/044_replace.sh
91+
run_test tests/shell/045_update_from_url_branch_uptodate.sh
92+
run_test tests/shell/046_update_from_url_branch.sh
93+
run_test tests/shell/047_absolute_path_modules.sh
94+
95+
# Summary
96+
_suite_end=$(date +%s)
97+
_suite_elapsed=$((_suite_end - _suite_start))
98+
echo ""
99+
echo "=============================="
100+
echo "Test Results: $_passed passed, $_failed failed, $_skipped skipped (total: $_total, ${_suite_elapsed}s)"
101+
if [ $_failed -gt 0 ]; then
102+
echo ""
103+
echo "Failed tests:"
104+
echo -e "$_failures"
105+
exit 1
106+
fi
107+
echo "=============================="
55108
echo "All cfbs shell tests completed successfully!"

0 commit comments

Comments
 (0)