Skip to content

Commit ecac615

Browse files
tests: isolate app config fixtures
Signed-off-by: yoshifuminakamura <nakamura@riken.jp>
1 parent a7edb7d commit ecac615

2 files changed

Lines changed: 70 additions & 21 deletions

File tree

‎scripts/tests/test_matrix_generate_filters.sh‎

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,59 @@ REPO_DIR=$(cd "${SCRIPT_DIR}/../.." && pwd)
77
TMP_DIR=$(mktemp -d)
88
trap 'rm -rf "${TMP_DIR}"' EXIT
99

10-
mkdir -p "${TMP_DIR}/project"
11-
ln -s "${REPO_DIR}/config" "${TMP_DIR}/project/config"
12-
ln -s "${REPO_DIR}/programs" "${TMP_DIR}/project/programs"
10+
mkdir -p "${TMP_DIR}/project/config" "${TMP_DIR}/project/programs/filterapp"
1311
ln -s "${REPO_DIR}/scripts" "${TMP_DIR}/project/scripts"
1412

13+
cat > "${TMP_DIR}/project/config/system.csv" <<'EOF'
14+
system,mode,tag_build,tag_run,queue,queue_group
15+
FilterSystem,cross,build-tag,run-tag,SLURM_TEST,debug
16+
EOF
17+
18+
cat > "${TMP_DIR}/project/config/queue.csv" <<'EOF'
19+
queue,submit_cmd,template
20+
SLURM_TEST,sbatch,"-p ${queue_group} -t ${elapse} -N ${nodes} --ntasks-per-node=${numproc_node} --cpus-per-task=${nthreads}"
21+
EOF
22+
23+
cat > "${TMP_DIR}/project/config/system_info.csv" <<'EOF'
24+
system,name,cpu_name,cpu_per_node,cpu_cores,gpu_name,gpu_per_node,memory,display_order
25+
FilterSystem,FilterSystem,CPU,1,32,GPU,1,64 GB,1
26+
EOF
27+
28+
cat > "${TMP_DIR}/project/programs/filterapp/list.csv" <<'EOF'
29+
system,enable,nodes,numproc_node,nthreads,elapse
30+
FilterSystem,yes,1,2,3,0:10:00
31+
FilterSystem,yes,2,2,3,0:10:00
32+
FilterSystem,yes,4,2,3,0:10:00
33+
EOF
34+
printf '#!/bin/bash\n' > "${TMP_DIR}/project/programs/filterapp/build.sh"
35+
printf '#!/bin/bash\n' > "${TMP_DIR}/project/programs/filterapp/run.sh"
36+
1537
pushd "${TMP_DIR}/project" >/dev/null
1638

17-
bash scripts/matrix_generate.sh code=sbd system=RIKYU nodes=1
18-
grep -q '^sbd_RIKYU_N1_P4_T32_run:' .gitlab-ci.generated.yml
39+
bash scripts/matrix_generate.sh code=filterapp system=FilterSystem nodes=1
40+
grep -q '^filterapp_FilterSystem_N1_P2_T3_run:' .gitlab-ci.generated.yml
1941
grep -q 'name: $CI_COMMIT_BRANCH' .gitlab-ci.generated.yml
20-
if grep -q '^sbd_RIKYU_N2_P4_T32_run:' .gitlab-ci.generated.yml; then
21-
echo "nodes=1 filter must not emit the SBD RIKYU 2-node job" >&2
42+
if grep -q '^filterapp_FilterSystem_N2_P2_T3_run:' .gitlab-ci.generated.yml; then
43+
echo "nodes=1 filter must not emit the 2-node fixture job" >&2
2244
exit 1
2345
fi
24-
if grep -q '^sbd_RIKYU_N4_P4_T32_run:' .gitlab-ci.generated.yml; then
25-
echo "nodes=1 filter must not emit the SBD RIKYU 4-node job" >&2
46+
if grep -q '^filterapp_FilterSystem_N4_P2_T3_run:' .gitlab-ci.generated.yml; then
47+
echo "nodes=1 filter must not emit the 4-node fixture job" >&2
2648
exit 1
2749
fi
2850

29-
bash scripts/matrix_generate.sh code=sbd system=RIKYU nodes='2, 4'
30-
if grep -q '^sbd_RIKYU_N1_P4_T32_run:' .gitlab-ci.generated.yml; then
31-
echo "nodes=2,4 filter must not emit the SBD RIKYU 1-node job" >&2
51+
bash scripts/matrix_generate.sh code=filterapp system=FilterSystem nodes='2, 4'
52+
if grep -q '^filterapp_FilterSystem_N1_P2_T3_run:' .gitlab-ci.generated.yml; then
53+
echo "nodes=2,4 filter must not emit the 1-node fixture job" >&2
3254
exit 1
3355
fi
34-
grep -q '^sbd_RIKYU_N2_P4_T32_run:' .gitlab-ci.generated.yml
35-
grep -q '^sbd_RIKYU_N4_P4_T32_run:' .gitlab-ci.generated.yml
56+
grep -q '^filterapp_FilterSystem_N2_P2_T3_run:' .gitlab-ci.generated.yml
57+
grep -q '^filterapp_FilterSystem_N4_P2_T3_run:' .gitlab-ci.generated.yml
3658

37-
BK_GITLAB_ENVIRONMENT=develop bash scripts/matrix_generate.sh code=sbd system=RIKYU nodes=1
59+
BK_GITLAB_ENVIRONMENT=develop bash scripts/matrix_generate.sh code=filterapp system=FilterSystem nodes=1
3860
grep -q 'name: "develop"' .gitlab-ci.generated.yml
3961

40-
if BK_GITLAB_ENVIRONMENT='bad scope' bash scripts/matrix_generate.sh code=sbd system=RIKYU nodes=1 >/dev/null 2>&1; then
62+
if BK_GITLAB_ENVIRONMENT='bad scope' bash scripts/matrix_generate.sh code=filterapp system=FilterSystem nodes=1 >/dev/null 2>&1; then
4163
echo "invalid BK_GITLAB_ENVIRONMENT must fail matrix generation" >&2
4264
exit 1
4365
fi

‎scripts/tests/test_scheduler_extra_args.sh‎

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ test "$(get_scheduler_extra_args RIKYU)" = "--account=global"
3333
test "$(get_scheduler_extra_args Fugaku)" = "--account=global"
3434

3535
tmpdir=""
36+
project_dir=""
3637
estimate_tmpdir=$(mktemp -d)
37-
trap 'rm -rf "$tmpdir" "$estimate_tmpdir"; rm -f "${REPO_DIR}/script.sh"' EXIT
38+
trap 'rm -rf "$tmpdir" "$estimate_tmpdir"' EXIT
3839

3940
mkdir -p "$estimate_tmpdir/app"
4041
if has_estimate_script "$estimate_tmpdir/app"; then
@@ -50,6 +51,30 @@ if has_estimate_script "$estimate_tmpdir/app"; then
5051
fi
5152

5253
tmpdir=$(mktemp -d)
54+
project_dir="$tmpdir/project"
55+
56+
mkdir -p "$project_dir/config" "$project_dir/programs/schedulerapp"
57+
ln -s "${REPO_DIR}/scripts" "$project_dir/scripts"
58+
59+
cat > "$project_dir/config/system.csv" <<'EOF'
60+
system,mode,tag_build,tag_run,queue,queue_group
61+
RC_GH200,native,,,SLURM_RC,gh200
62+
Fugaku,cross,,,FJ,small
63+
EOF
64+
65+
cat > "$project_dir/config/system_info.csv" <<'EOF'
66+
system,name,cpu_name,cpu_per_node,cpu_cores,gpu_name,gpu_per_node,memory,display_order
67+
RC_GH200,RC_GH200,CPU,1,72,GPU,1,120 GB,1
68+
Fugaku,Fugaku,CPU,1,48,-,-,32 GB,2
69+
EOF
70+
71+
cat > "$project_dir/programs/schedulerapp/list.csv" <<'EOF'
72+
system,enable,nodes,numproc_node,nthreads,elapse
73+
RC_GH200,yes,1,1,1,0:05:00
74+
Fugaku,yes,1,2,3,0:05:00
75+
EOF
76+
printf '#!/bin/bash\n' > "$project_dir/programs/schedulerapp/build.sh"
77+
printf '#!/bin/bash\n' > "$project_dir/programs/schedulerapp/run.sh"
5378

5479
cat >"$tmpdir/sbatch" <<'SCRIPT'
5580
#!/bin/bash
@@ -65,14 +90,15 @@ unset BK_SCHEDULER_EXTRA_ARGS_RIKYU
6590
unset BK_SCHEDULER_EXTRA_ARGS_Fugaku
6691
unset BK_SCHEDULER_EXTRA_ARGS_RC_GH200
6792

68-
bash scripts/test_submit_build.sh qws 5 >/dev/null
93+
pushd "$project_dir" >/dev/null
94+
bash scripts/test_submit_build.sh schedulerapp 1 >/dev/null
6995
if grep -q -- "--account=rkp00010" "$BK_TEST_SBATCH_ARGS_FILE"; then
7096
echo "RC_GH200 must not derive --account from BK_ALLOCATION_PROJECT_ID" >&2
7197
exit 1
7298
fi
7399

74100
export BK_SCHEDULER_EXTRA_ARGS_RC_GH200="--account=explicit-rc"
75-
bash scripts/test_submit_build.sh qws 5 >/dev/null
101+
bash scripts/test_submit_build.sh schedulerapp 1 >/dev/null
76102
grep -q -- "--account=explicit-rc" "$BK_TEST_SBATCH_ARGS_FILE"
77103

78104
cat >"$tmpdir/pjsub" <<'SCRIPT'
@@ -86,15 +112,16 @@ export BK_ALLOCATION_PROJECT_ID="ra000009"
86112
unset BK_SCHEDULER_EXTRA_ARGS
87113
unset BK_SCHEDULER_EXTRA_ARGS_Fugaku
88114

89-
bash scripts/test_submit.sh qws 2 >/dev/null
115+
bash scripts/test_submit.sh schedulerapp 2 >/dev/null
90116
grep -q -- "-g ra000009" "$BK_TEST_PJSUB_ARGS_FILE"
91117

92118
unset BK_ALLOCATION_PROJECT_ID
93-
bash scripts/test_submit.sh qws 2 >/dev/null
119+
bash scripts/test_submit.sh schedulerapp 2 >/dev/null
94120
if grep -q -- "-g" "$BK_TEST_PJSUB_ARGS_FILE"; then
95121
echo "Fugaku must not pass -g when BK_ALLOCATION_PROJECT_ID is unset" >&2
96122
exit 1
97123
fi
124+
popd >/dev/null
98125

99126
popd >/dev/null
100127

0 commit comments

Comments
 (0)