Skip to content
Snippets Groups Projects
Commit cfad80a3 authored by ghuter's avatar ghuter
Browse files

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
parent a4c05068
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ This directory is for tests against the g5k (grid5000) infrastructure. ...@@ -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, It should contain the "run" script, "ssh.pre.config", test executables,
and a configuration file named "config". and a configuration file named "config".
CONFIGURATION CONFIGURATION
-------------- --------------
...@@ -40,6 +41,56 @@ By default, without any other arguments, it will run all tests defined in ...@@ -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 the config file. If you specify any further arguments, it will interpret
them as regular expressions and look for matches through the config file. them as regular expressions and look for matches through the config file.
For now, test results (their standard output and standard error output), Test results are sent back as their standard output and standard error
are sent back to the current working directory as an OAR.<id>.stderr output combined, each line prefixed with: "<test_filename>:". Therefore,
and an OAR.<id>.stdout file. 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
...@@ -75,6 +75,7 @@ for site in $sites; do ...@@ -75,6 +75,7 @@ for site in $sites; do
cluster_runner=${base}/${site}-${cluster}-run.sh cluster_runner=${base}/${site}-${cluster}-run.sh
echo '#!/bin/sh' > "$cluster_runner" echo '#!/bin/sh' > "$cluster_runner"
echo 'exec 2>&1' >> "$cluster_runner"
for f in $files; do for f in $files; do
[ -r "$f" ] || { [ -r "$f" ] || {
...@@ -82,17 +83,25 @@ for site in $sites; do ...@@ -82,17 +83,25 @@ for site in $sites; do
continue continue
} }
destf=${cluster}-${f} destf=${cluster}-${f}
scp -F "$ssh_conf" "$f" "${site}.g5k:${destf}" || continue 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 done
scp -F "$ssh_conf" "$cluster_runner" "${site}.g5k:${cluster}-run.sh" || scp -F "$ssh_conf" "$cluster_runner" "${site}.g5k:${cluster}-run.sh" ||
continue continue
{ {
echo "chmod +x \"\$HOME/${cluster}-run.sh\"" printf 'chmod +x "$HOME/%s-run.sh"\n' "$cluster"
echo "eval \"\$(oarsub -p ${cluster} \"~/${cluster}-run.sh\")\"" printf 'eval "$(oarsub -p "%s" "~/%s-run.sh")"\n' "$cluster" "$cluster"
echo "echo \$OAR_JOB_ID" printf 'echo $OAR_JOB_ID\n'
} >> "$site_runner" } >> "$site_runner"
done done
...@@ -108,8 +117,9 @@ for site in $sites; do ...@@ -108,8 +117,9 @@ for site in $sites; do
if ssh -F "$ssh_conf" "${site}.g5k" \ if ssh -F "$ssh_conf" "${site}.g5k" \
"! { oarstat -u \"$user\" | grep -q \"$id\"; }" "! { oarstat -u \"$user\" | grep -q \"$id\"; }"
then 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") oar_job_ids=$(echo "$oar_job_ids" | grep -vF "$id")
fi fi
done done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment