From cfad80a39a651b358471204ec3ae665cefc952a2 Mon Sep 17 00:00:00 2001 From: ghuter <ghuter@disroot.org> Date: Tue, 11 Apr 2023 14:43:06 +0200 Subject: [PATCH] Tests outputs are now sent to stdout - add prefixing to tests outputs (test filenames) - use printf instead of echo in more places, for readability - redirect tests stderr to stdout - update readme to reflect changes - add an "examples" section to the readme --- tests/g5k/README | 57 +++++++++++++++++++++++++++++++++++++++++++++--- tests/g5k/run | 24 ++++++++++++++------ 2 files changed, 71 insertions(+), 10 deletions(-) diff --git a/tests/g5k/README b/tests/g5k/README index fbead6b..01b0d76 100644 --- a/tests/g5k/README +++ b/tests/g5k/README @@ -2,6 +2,7 @@ This directory is for tests against the g5k (grid5000) infrastructure. It should contain the "run" script, "ssh.pre.config", test executables, and a configuration file named "config". + CONFIGURATION -------------- @@ -40,6 +41,56 @@ By default, without any other arguments, it will run all tests defined in the config file. If you specify any further arguments, it will interpret them as regular expressions and look for matches through the config file. -For now, test results (their standard output and standard error output), -are sent back to the current working directory as an OAR.<id>.stderr -and an OAR.<id>.stdout file. +Test results are sent back as their standard output and standard error +output combined, each line prefixed with: "<test_filename>:". Therefore, +one can have the output of, say, "test-load.sh", by piping `run` into +`grep '^test-load.sh' | cut -d ':' -f 2-`. + + +EXAMPLES +-------- + +In the following examples, the given example config is supposed: + +``` +# site:cluster:test-filename + +lille:chifflet:test-nvidia.sh +lille:chifflet:test-rapl.sh +lille:chifflet:test-counters.sh +lille:chifflet:test-temp.sh +lille:chifflet:test-load.sh +lille:chifflet:test-network.sh + +lille:chiclet:test-amd-rapl.sh +lille:chiclet:test-infiniband.sh + +nancy:grisou-49:test-infiniband.sh +``` + +Run "test-load" test: + + ./run -u joe -i idfile test-load + +Run "test-counters" and "test-rapl" tests (notice that we write +"test-rapl" in the command and not simply "rapl", because if we don't, +both "test-rapl" and "test-amd-rapl" would be executed): + + ./run -u joe -i idfile counters test-rapl + +Run all lille tests: + + ./run -u joe -i idfile lille + +Run infiniband test on nancy site: + + ./run -u joe -i idfile 'nancy.*infiniband' + +Run infiniband test on all specified sites: + + ./run -u joe -i idfile infiniband + +Run all tests which are defined to use the chiclet cluster: + + ./run -u joe -i idfile chiclet + diff --git a/tests/g5k/run b/tests/g5k/run index 5dd85c2..1cc7af7 100755 --- a/tests/g5k/run +++ b/tests/g5k/run @@ -75,6 +75,7 @@ for site in $sites; do cluster_runner=${base}/${site}-${cluster}-run.sh echo '#!/bin/sh' > "$cluster_runner" + echo 'exec 2>&1' >> "$cluster_runner" for f in $files; do [ -r "$f" ] || { @@ -82,17 +83,25 @@ for site in $sites; do continue } destf=${cluster}-${f} + scp -F "$ssh_conf" "$f" "${site}.g5k:${destf}" || continue - echo "chmod +x \"\$HOME/$destf\"" >> "$cluster_runner" - echo "~/$destf" >> "$cluster_runner" + + { + printf '{\n' + printf '\tchmod +x "$HOME/%s"\n' "$destf" + printf '\t$HOME/%s\n' "$destf" + printf "} | awk -v 'prefix=%s' '%s'\n" \ + "$destf" '{printf("%s:%s\n", prefix, $0)}' + } >> "$cluster_runner" done scp -F "$ssh_conf" "$cluster_runner" "${site}.g5k:${cluster}-run.sh" || continue + { - echo "chmod +x \"\$HOME/${cluster}-run.sh\"" - echo "eval \"\$(oarsub -p ${cluster} \"~/${cluster}-run.sh\")\"" - echo "echo \$OAR_JOB_ID" + printf 'chmod +x "$HOME/%s-run.sh"\n' "$cluster" + printf 'eval "$(oarsub -p "%s" "~/%s-run.sh")"\n' "$cluster" "$cluster" + printf 'echo $OAR_JOB_ID\n' } >> "$site_runner" done @@ -108,8 +117,9 @@ for site in $sites; do if ssh -F "$ssh_conf" "${site}.g5k" \ "! { oarstat -u \"$user\" | grep -q \"$id\"; }" then - scp -F "$ssh_conf" "${site}.g5k:OAR.${id}.stderr" "OAR.${id}.stderr" - scp -F "$ssh_conf" "${site}.g5k:OAR.${id}.stdout" "OAR.${id}.stdout" + scp -F "$ssh_conf" "${site}.g5k:OAR.${id}.stdout" "OAR.${id}.stdout" && + cat "OAR.${id}.stdout" && + rm -f "OAR.${id}.stdout" oar_job_ids=$(echo "$oar_job_ids" | grep -vF "$id") fi done -- GitLab