From acc64252187e7a60f045b649c326993a754c57f1 Mon Sep 17 00:00:00 2001 From: Maxim Kuvyrkov Date: Thu, 29 Jul 2021 08:34:09 +0000 Subject: tcwg-benchmark.sh: Swap toolchain preparation and board preparation ... so that we can use board as a builder. Change-Id: Ib911b906c477bdd53d081b28c194c8f2074cbf83 --- tcwg-benchmark.sh | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/tcwg-benchmark.sh b/tcwg-benchmark.sh index c2709722..a962b53f 100755 --- a/tcwg-benchmark.sh +++ b/tcwg-benchmark.sh @@ -59,6 +59,8 @@ prepare_board="${prepare_board-true}" # shellcheck source=jenkins-helpers.sh . $scripts/jenkins-helpers.sh +prepare_toolchain () +{ # If $toolchain_url is of ssh:// type, don't create a remote build # container, just use the ssh command as provided. build_container_host= @@ -92,20 +94,24 @@ case "$toolchain_url" in fi ;; *) - build_container_tag="${builder#*:}" - builder="${builder%:*}" - if echo "$builder" | grep -q ".*-[0-9]\+"; then - # Builder is a specific node - docker_host_opt="--arch amd64 --node $builder" + if [ x"$builder" = x"bmk_board" ]; then + # shellcheck disable=SC2154 + build_container_host=$run_container_host + # shellcheck disable=SC2154 + build_container_port=$run_container_port else - docker_host_opt="--label $builder" - fi + build_container_tag="${builder#*:}" + builder="${builder%:*}" + if echo "$builder" | grep -q ".*-[0-9]\+"; then + # Builder is a specific node + docker_host_opt="--arch amd64 --node $builder" + else + docker_host_opt="--label $builder" + fi - # Make sure to cleanup build container if something goes - # wrong when preparing the test environment - trap "cleanup_all_containers" EXIT - $scripts/start-container-docker.sh $docker_host_opt --distro "$build_container_tag" --task build --prefix build_ > build-container.sh - . ./build-container.sh + $scripts/start-container-docker.sh $docker_host_opt --distro "$build_container_tag" --task build --prefix build_ > build-container.sh + . ./build-container.sh + fi ;; esac @@ -244,6 +250,7 @@ case "$sysroot" in exit 1 ;; esac +} if echo "$results_id" | grep -q "\.\."; then echo "ERROR: results_id should not escape /home/tcwg-benchmark/results* hierarchy; do not use \"..\"" @@ -353,6 +360,10 @@ if $prepare_board; then fi fi +# Make sure to cleanup build container if something goes +# wrong when preparing the test environment +trap "cleanup_all_containers" EXIT + # Start a container to run the benchmarks in. # We install SPEC in /home/tcwg-benchmark, so bind-mount it as $WORKSPACE. WORKSPACE=$HOME $scripts/start-container-docker.sh --session-host "$boardname" --arch "$image_arch" --distro "$bench_container_tag" --task bench --docker_opts "--privileged" --prefix run_ > run-container.sh & @@ -367,6 +378,8 @@ trap "cleanup_all_containers" EXIT . ./run-container.sh declare -g run_container_host run_container_port +prepare_toolchain + case "$bench_list" in coremark) remote_exec "$run_container_host:$run_container_port:$WORKSPACE/bmk-scripts:-t -Snone" \ -- cgit v1.2.3