Skip to content

Commit 789831a

Browse files
committed
Be agnostic to the current working directory of the replication scripts
This is a potential error source for the artifact reviewers. Hence, it's better to automatically handle this case instead of letting the reviewer handle the error.
1 parent 4be68ca commit 789831a

4 files changed

Lines changed: 10 additions & 28 deletions

File tree

replication/esecfse22/build.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
#!/usr/bin/env bash
2-
# Assure that the script is only called from the esecfse22 folder
3-
current_dir=$(pwd)
4-
expected_path="/replication/esecfse22"
5-
if [[ ! $current_dir =~ $expected_path ]]; then
6-
echo "error: the script must be run from inside the esecfse22 directory, i.e., DiffDetective$expected_path"
7-
exit 1
8-
fi
92

103
# We have to switch to the root directory of the project and build the Docker image from there,
114
# because Docker only allows access to the files in the current file system subtree (i.e., no access to ancestors).
125
# We have to do this to get access to 'src', 'docker', 'local-maven-repo', etc.
13-
cd ../..
6+
# For resiliency against different working directories during execution of this
7+
# script we calculate the correct path using the special bash variable
8+
# BASH_SOURCE.
9+
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit
1410

1511
docker build -t diff-detective -f replication/esecfse22/Dockerfile .

replication/esecfse22/execute.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#!/usr/bin/env bash
22
# Assure that the script is only called from the esecfse22 folder
3-
current_dir=$(pwd)
4-
expected_path="/replication/esecfse22"
5-
if [[ ! $current_dir =~ $expected_path ]]; then
6-
echo "error: the script must be run from inside the esecfse22 directory, i.e., DiffDetective$expected_path"
7-
exit 1
8-
fi
3+
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit
94

105
if [[ $# -gt 0 ]]; then
116
echo "Executing $1"

replication/splc23-views/build.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
#!/usr/bin/env bash
2-
# Assure that the script is only called from the splc23-views folder
3-
current_dir=$(pwd)
4-
expected_path="/replication/splc23-views"
5-
if [[ ! $current_dir =~ $expected_path ]]; then
6-
echo "error: the script must be run from inside the splc23-views directory, i.e., DiffDetective$expected_path"
7-
exit 1
8-
fi
92

103
# We have to switch to the root directory of the project and build the Docker image from there,
114
# because Docker only allows access to the files in the current file system subtree (i.e., no access to ancestors).
125
# We have to do this to get access to 'src', 'docker', 'local-maven-repo', etc.
13-
cd ../..
6+
# For resiliency against different working directories during execution of this
7+
# script we calculate the correct path using the special bash variable
8+
# BASH_SOURCE.
9+
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit
1410

1511
docker build -t diff-detective-views -f replication/splc23-views/Dockerfile .

replication/splc23-views/execute.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#!/usr/bin/env bash
22
# Assure that the script is only called from the splc23-views folder
3-
current_dir=$(pwd)
4-
expected_path="/replication/splc23-views"
5-
if [[ ! $current_dir =~ $expected_path ]]; then
6-
echo "error: the script must be run from inside the splc23-views directory, i.e., DiffDetective$expected_path"
7-
exit 1
8-
fi
3+
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit
94

105
if [[ $# -gt 0 ]]; then
116
echo "Executing $1"

0 commit comments

Comments
 (0)