Skip to content

Commit 9ed7dc5

Browse files
committed
More attempts to read from mounted dir
Under some circumstances the mounts do not work. Lets add more info and more variants to proceed later
1 parent 2ba2460 commit 9ed7dc5

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
set -ex
3+
set -o pipefail
4+
5+
## resolve folder of this script, following all symlinks,
6+
## http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
7+
SCRIPT_SOURCE="${BASH_SOURCE[0]}"
8+
while [ -h "$SCRIPT_SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
9+
SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )"
10+
SCRIPT_SOURCE="$(readlink "$SCRIPT_SOURCE")"
11+
# if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
12+
[[ $SCRIPT_SOURCE != /* ]] && SCRIPT_SOURCE="$SCRIPT_DIR/$SCRIPT_SOURCE"
13+
done
14+
readonly SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )"
15+
16+
source $SCRIPT_DIR/testlib.bash
17+
18+
if ! which sudo; then
19+
echo '!skipped! No sudo on system'
20+
exit
21+
fi
22+
23+
parseArguments "$@"
24+
processArguments
25+
setup
26+
tryJreCompilation sudo 2>&1| tee $REPORT_FILE

containersQa/testlib.bash

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ function runOnBaseDirBash() {
231231
function runOnBaseDirBashWithMount() {
232232
local d=$(mktemp -d)
233233
cp -r $LIBCQA_SCRIPT_DIR/*.java "${d}"
234-
$PD_PROVIDER run -v="${d}:/testsDir" -i "$HASH" bash -c "${1}"
234+
chmod 777 "${d}"
235+
ls -ld ${d}
236+
${2} $PD_PROVIDER run -v="${d}:/testsDir:Z" -i "$HASH" bash -c "${1}"
235237
rm -rf "${d}"
236238
}
237239

@@ -1163,13 +1165,16 @@ function assertCryptoProviders() {
11631165

11641166

11651167
function tryJreCompilation() {
1166-
runOnBaseDirBashWithMount "ls /testsDir | grep \\.java$"
1168+
# if mount do not work, skip?
1169+
runOnBaseDirBashWithMount "ls -l /" "$1"
1170+
runOnBaseDirBashWithMount "ls -ld /testsDir" "$1"
1171+
runOnBaseDirBashWithMount "ls -l /testsDir | grep \\.java$" "$1"
11671172
local v=$(runOnBaseDirBashWithMount "java -version " 2>&1 | grep "openjdk version" | head -n 1)
11681173
if echo "$v" | grep '"1.8' || echo "$v" | grep '"11' ; then
11691174
echo '!skipped! Skipping runtime compilation on 8 and 11'
11701175
exit 0
11711176
else
11721177
echo '17+, going on'
11731178
fi
1174-
runOnBaseDirBashWithMount "java /testsDir/InProcessCompileDemo.java"
1179+
runOnBaseDirBashWithMount "java /testsDir/InProcessCompileDemo.java" "$1"
11751180
}

0 commit comments

Comments
 (0)