Skip to content

Commit 3d73b64

Browse files
authored
Update testHeadlessComponents.sh
returning SCRIPT_DIR as other means to obtain relevant script home directory proved impractical
1 parent b9410cd commit 3d73b64

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

testHeadlessComponents.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ set -o pipefail
77
## assumes that both directories with old and new rpms are provided and filled with relevant rpms
88
## this script attempts parallel installation of old and new set of rpms
99

10+
## resolve folder of this script, following all symlinks,
11+
## http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
12+
SCRIPT_SOURCE="${BASH_SOURCE[0]}"
13+
while [ -h "$SCRIPT_SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
14+
SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )"
15+
SCRIPT_SOURCE="$(readlink "$SCRIPT_SOURCE")"
16+
# if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
17+
[[ $SCRIPT_SOURCE != /* ]] && SCRIPT_SOURCE="$SCRIPT_DIR/$SCRIPT_SOURCE"
18+
done
19+
readonly SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )"
20+
1021
function run_java_with_headless {
1122
COMPONENTS_TO_TEST=$2
1223
$JAVA -cp $cp -Djava.awt.headless=$1 MainRunner -test=$COMPONENTS_TO_TEST -jreSdkHeadless=$JREJDK -displayValue=$DISPLAY
@@ -68,7 +79,7 @@ PASSED=0
6879
IGNORED=0
6980
BODY=""
7081

71-
source RFaT/jtreg-shell-xml.sh
82+
source $SCRIPT_DIR/RFaT/jtreg-shell-xml.sh
7283

7384
if [[ -z "${WORKSPACE}" ]]; then
7485
WORKSPACE=~/workspace

0 commit comments

Comments
 (0)