commit 243a8f150f5f79c7530b415ca9df09bdbebd0cf9 from: Omar Polo date: Sun Jan 08 18:00:16 2023 UTC util/got-build-regress.sh: simplify lockfile cleanup trap on EXIT too so the lockfile is deleted on quit (both successful and not.) While here simplify a cd too. ok stsp@ commit - de9bfe528565e8074ae67514ca6f3512aae41b67 commit + 243a8f150f5f79c7530b415ca9df09bdbebd0cf9 blob - ecad672dd9987061ffe33a14f45c754453877ea2 blob + dfb4247519cf71225106b839c0671acd77708978 --- util/got-build-regress.sh +++ util/got-build-regress.sh @@ -57,13 +57,10 @@ log_cmd() { ncpu=`sysctl -n hw.ncpuonline` lockfile=$worktree/.${prog}.lock -cd "$worktree" -if [ $? -ne 0 ]; then - exit 1 -fi +cd "$worktree" || exit 1 lockfile -r 3 "$lockfile" || exit 1 -trap "rm -f '$lockfile'" HUP INT QUIT KILL TERM +trap "rm -f '$lockfile'" HUP INT QUIT KILL TERM EXIT rm -f regress.log failures.log echo -n "$prog for branch '$branch' on " > build.log @@ -83,13 +80,11 @@ log_cmd build.log /usr/local/bin/got update -b "$branc update_status="$?" if [ "$update_status" != "0" ]; then mail $fromaddr_arg -s "$prog update failure" $recipients < build.log - rm -rf "$lockfile" exit 0 fi new_basecommit=`cat .got/base-commit` if [ "$force" != "1" -a "$old_basecommit" == "$new_basecommit" ]; then - rm -rf "$lockfile" exit 0 fi @@ -99,7 +94,6 @@ log_cmd build.log make -j $ncpu build_status="$?" if [ "$build_status" != "0" ]; then mail $fromaddr_arg -s "$prog build failure" $recipients < build.log - rm -rf "$lockfile" exit 0 fi log_cmd build.log make install @@ -107,7 +101,6 @@ log_cmd build.log make -j $ncpu webd build_status="$?" if [ "$build_status" != "0" ]; then mail $fromaddr_arg -s "$prog build failure" $recipients < build.log - rm -rf "$lockfile" exit 0 fi @@ -121,7 +114,6 @@ if [ "$regress_status" != "0" -o "$regress_failure_gre printf "\n\n\t Test failures:\n\n" >> build.log cat failures.log >> build.log mail $fromaddr_arg -s "$prog regress failure" $recipients < build.log - rm -rf "$lockfile" exit 0 fi @@ -135,7 +127,6 @@ if [ "$regress_status" != "0" -o "$regress_failure_gre printf "\n\n\t Test failures:\n\n" >> build.log cat failures.log >> build.log mail $fromaddr_arg -s "$prog regress failure" $recipients < build.log - rm -rf "$lockfile" exit 0 fi @@ -147,10 +138,7 @@ log_cmd build.log make -j $ncpu GOT_RELEASE=Yes webd build_status="$?" if [ "$build_status" != "0" ]; then mail $fromaddr_arg -s "$prog release mode build failure" $recipients < build.log - rm -rf "$lockfile" exit 0 fi - -rm -f "$lockfile" exit 0