Skip to content

Commit

Permalink
docker: add test_wrapper.sh to load scl libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
vvbandeira committed Mar 25, 2021
1 parent af3bc28 commit 5ffd104
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
5 changes: 2 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
**/.git
docker
build
.git
build*
Dockerfile
2 changes: 1 addition & 1 deletion docker/Dockerfile.runtime
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# instead use etc/DockerHelper.sh

ARG copyImage=openroad/centos7-builder:latest
# need to use the line below as the --from does not accept an ARG
# need to use the line below as the "COPY --from" does not accept an ARG
FROM $copyImage AS copyfrom

ARG fromImage=centos:centos7
Expand Down
22 changes: 22 additions & 0 deletions docker/test_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -eo pipefail

cd "$(dirname $(readlink -f $0))/../"

compiler=${1:-gcc}
if [[ "${compiler}" == "gcc" ]]; then
if [[ -f "/opt/rh/devtoolset-8/enable" ]]; then
source /opt/rh/devtoolset-8/enable
fi
shift 1
fi

if [[ "${compiler}" == "clang" ]]; then
if [[ -f "/opt/rh/llvm-toolset-7.0/enable" ]]; then
source /opt/rh/llvm-toolset-7.0/enable
fi
shift 1
fi

eval "${@}"
10 changes: 7 additions & 3 deletions etc/Build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ set -eo pipefail

cd "$(dirname $(readlink -f $0))/../"

# default values, can be overwritten by cmdline args
buildDir="build"
numThreads="$(nproc)"
cmakeOptions=()
cleanBefore=no
keepLog=no
compiler=gcc

_help() {
cat <<EOF
Expand Down Expand Up @@ -77,7 +81,7 @@ while [ "$#" -gt 0 ]; do
shift 1
done

case "${compiler:-gcc}" in
case "${compiler}" in
"gcc" )
if [[ -f "/opt/rh/devtoolset-8/enable" ]]; then
source /opt/rh/devtoolset-8/enable
Expand All @@ -97,12 +101,12 @@ case "${compiler:-gcc}" in
_help 1
esac

if [[ "${cleanBefore:-no}" == "yes" ]]; then
if [[ "${cleanBefore}" == "yes" ]]; then
rm -rf "${buildDir}"
fi

mkdir -p "${buildDir}"
if [[ "${keepLog:-no}" == "yes" ]]; then
if [[ "${keepLog}" == "yes" ]]; then
logName="${buildDir}/openroad-build-$(date +%s).log"
else
logName=/dev/null
Expand Down
2 changes: 1 addition & 1 deletion etc/DockerHelper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ _test() {
echo "Could not find ${imagePath}, will attempt to create it" >&2
_create
fi
docker run --rm "${imagePath}" "./test/regression"
docker run --rm "${imagePath}" "./docker/test_wrapper.sh" "${compiler}" "./test/regression"
}

_create() {
Expand Down

0 comments on commit 5ffd104

Please sign in to comment.