Ensure correct working dir for the tasks
This commit is contained in:
parent
cbc8fd60eb
commit
63745cdf54
|
@ -33,6 +33,9 @@ function setup {
|
||||||
echo "$GITREPO" > $FORGEBUILDDIR/branch.source
|
echo "$GITREPO" > $FORGEBUILDDIR/branch.source
|
||||||
echo "cat \$GITBUILDDIR/.branch/branch > /tmp/forgebuild-branch" > $FORGEBUILDDIR/branch
|
echo "cat \$GITBUILDDIR/.branch/branch > /tmp/forgebuild-branch" > $FORGEBUILDDIR/branch
|
||||||
chmod +x $FORGEBUILDDIR/branch
|
chmod +x $FORGEBUILDDIR/branch
|
||||||
|
echo "echo \$(pwd) > /tmp/forgebuild-pwd" > $FORGEBUILDDIR/pwd
|
||||||
|
chmod +x $FORGEBUILDDIR/pwd
|
||||||
|
echo "$GITREPO" > $FORGEBUILDDIR/pwd.source
|
||||||
|
|
||||||
# Setup settings
|
# Setup settings
|
||||||
mkdir $FORGEBUILDDIR/config
|
mkdir $FORGEBUILDDIR/config
|
||||||
|
@ -51,6 +54,7 @@ function clean {
|
||||||
if [ -f /tmp/forgebuild-time ]; then rm /tmp/forgebuild-time; fi
|
if [ -f /tmp/forgebuild-time ]; then rm /tmp/forgebuild-time; fi
|
||||||
if [ -f /tmp/forgebuild-host ]; then rm /tmp/forgebuild-host; fi
|
if [ -f /tmp/forgebuild-host ]; then rm /tmp/forgebuild-host; fi
|
||||||
if [ -f /tmp/forgebuild-branch ]; then rm /tmp/forgebuild-branch; fi
|
if [ -f /tmp/forgebuild-branch ]; then rm /tmp/forgebuild-branch; fi
|
||||||
|
if [ -f /tmp/forgebuild-pwd ]; then rm /tmp/forgebuild-pwd; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Simple repository
|
# Simple repository
|
||||||
|
@ -65,6 +69,18 @@ function clean {
|
||||||
[ -f /tmp/forgebuild-time ]
|
[ -f /tmp/forgebuild-time ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "task is run from within its source folder" {
|
||||||
|
$FORGEBUILD -b $FORGEBUILDDIR pwd
|
||||||
|
PWD="$(cat /tmp/forgebuild-pwd)"
|
||||||
|
[[ "$PWD" = "$FORGEBUILDDIR/.pwd" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "after running, back to the previous working dir" {
|
||||||
|
cd /tmp
|
||||||
|
$FORGEBUILD -b $FORGEBUILDDIR pwd
|
||||||
|
[[ "$(pwd)" = "/tmp" ]]
|
||||||
|
}
|
||||||
|
|
||||||
@test "no update does not trigger task" {
|
@test "no update does not trigger task" {
|
||||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||||
[ -f /tmp/forgebuild-time ]
|
[ -f /tmp/forgebuild-time ]
|
||||||
|
|
|
@ -17,6 +17,8 @@ function setup {
|
||||||
mkdir $FORGEBUILDDIR
|
mkdir $FORGEBUILDDIR
|
||||||
echo "date +%s%N > /tmp/forgebuild-time" > $FORGEBUILDDIR/time
|
echo "date +%s%N > /tmp/forgebuild-time" > $FORGEBUILDDIR/time
|
||||||
chmod +x $FORGEBUILDDIR/time
|
chmod +x $FORGEBUILDDIR/time
|
||||||
|
echo "echo \$(pwd) > /tmp/forgebuild-pwd" > $FORGEBUILDDIR/pwd
|
||||||
|
chmod +x $FORGEBUILDDIR/pwd
|
||||||
|
|
||||||
# Setup settings
|
# Setup settings
|
||||||
mkdir $FORGEBUILDDIR/config
|
mkdir $FORGEBUILDDIR/config
|
||||||
|
@ -47,6 +49,19 @@ function clean {
|
||||||
[[ "$TIME" = "$NEWTIME" ]]
|
[[ "$TIME" = "$NEWTIME" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "sourceless task working dir is FORGEBUILDDIR" {
|
||||||
|
$FORGEBUILD -b $FORGEBUILDDIR pwd
|
||||||
|
PWD="$(cat /tmp/forgebuild-pwd)"
|
||||||
|
cp /tmp/forgebuild-pwd{,-2}
|
||||||
|
[[ "$PWD" = "$FORGEBUILDDIR" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "after running, back to the previous working dir" {
|
||||||
|
cd /tmp
|
||||||
|
$FORGEBUILD -b $FORGEBUILDDIR pwd
|
||||||
|
[[ "$(pwd)" = "/tmp" ]]
|
||||||
|
}
|
||||||
|
|
||||||
@test "sourceless task is not forced triggered by --force flag" {
|
@test "sourceless task is not forced triggered by --force flag" {
|
||||||
$FORGEBUILD -b $FORGEBUILDDIR time
|
$FORGEBUILD -b $FORGEBUILDDIR time
|
||||||
[ -f /tmp/forgebuild-time ]
|
[ -f /tmp/forgebuild-time ]
|
||||||
|
|
Loading…
Reference in New Issue