]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
ftests-wrapper: remove the timeout logic
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 4 Dec 2024 07:09:33 +0000 (12:39 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 5 Dec 2024 14:13:35 +0000 (07:13 -0700)
With commit e475d7a545a2 ("github: Use default runners"), the dependency
on the self-hosted runners is removed. Also, remove the timeout logic to
synchronize jobs between self-hosted runners too.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
tests/ftests/ftests-wrapper.sh

index d5eaaa2d28c328a509229a277c7e7af0795c4a4f..c62e9e1fee03b2d3625337f7515c2746361998b3 100755 (executable)
@@ -1,24 +1,9 @@
 #!/bin/bash
 # SPDX-License-Identifier: LGPL-2.1-only
 
-# the lock file is removed after all the tests complete
-function cleanup()
-{
-       sudo rm -f "$RUNNER_LOCK_FILE"
-       exit "$1"
-}
-
 AUTOMAKE_SKIPPED=77
 AUTOMAKE_HARD_ERROR=99
 
-# synchronize between different github runners running on
-# same VM's, this will stop runners from stomping over
-# each other's run.
-LIBCGROUP_RUN_DIR="/var/run/libcgroup/"
-RUNNER_LOCK_FILE="/var/run/libcgroup/github-runner.lock"
-RUNNER_SLEEP_SECS=300          # sleep for 5 minutes
-RUNNER_MAX_TRIES=10            # Abort after 50 minutes, if we don't chance to run
-
 START_DIR=$PWD
 SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
 
@@ -28,34 +13,12 @@ fi
 
 PYTHON_LIBRARY_PATH=(../../src/python/build/lib*)
 if [ -d  "${PYTHON_LIBRARY_PATH[0]}" ]; then
-       pushd "${PYTHON_LIBRARY_PATH[0]}" || cleanup $AUTOMAKE_HARD_ERROR
+       pushd "${PYTHON_LIBRARY_PATH[0]}" || exit $AUTOMAKE_HARD_ERROR
        PYTHONPATH="$PYTHONPATH:$(pwd)"
        export PYTHONPATH
-       popd || cleanup $AUTOMAKE_HARD_ERROR
+       popd || exit $AUTOMAKE_HARD_ERROR
 fi
 
-# If other runners are running then the file exists
-# let's wait for 50 minutes, before aborting.
-time_waited=0
-pretty_time=0
-while [ -f "$RUNNER_LOCK_FILE" ]; do
-       if [ "$RUNNER_MAX_TRIES" -le 0 ]; then
-               echo "Unable to get lock to run the ftests, aborting"
-               exit 1
-       fi
-
-       RUNNER_MAX_TRIES=$(( RUNNER_MAX_TRIES - 1 ))
-       sleep "$RUNNER_SLEEP_SECS"
-
-       time_waited=$(( time_waited + RUNNER_SLEEP_SECS ))
-       pretty_time=$(echo $time_waited | awk '{printf "%d:%02d:%02d", $1/3600, ($1/60)%60, $1%60}')
-       echo "[$pretty_time] Waiting on other runners to complete, $RUNNER_MAX_TRIES retries left"
-done
-
-# take the lock and start executing
-sudo mkdir -p "$LIBCGROUP_RUN_DIR"
-sudo touch "$RUNNER_LOCK_FILE"
-
 ./ftests.py -l 10 -L "$START_DIR/ftests.py.log" -n Libcg"$RANDOM"
 RET1=$?
 
@@ -71,7 +34,7 @@ else
        srcdir=$srcdir"/"
 fi
 
-sudo cp $srcdir../../src/libcgroup_systemd_idle_thread /bin
+sudo cp "$srcdir../../src/libcgroup_systemd_idle_thread" /bin
 sudo PYTHONPATH="$PYTHONPATH" ./ftests.py -l 10 -s "sudo" \
        -L "$START_DIR/ftests-nocontainer.py.sudo.log" --no-container -n Libcg"$RANDOM"
 RET3=$?
@@ -87,25 +50,25 @@ fi
 
 if [[ $RET1 -ne $AUTOMAKE_SKIPPED ]] && [[ $RET1 -ne 0 ]]; then
        # always return errors from the first test run
-       cleanup $RET1
+       exit $RET1
 fi
 if [[ $RET2 -ne $AUTOMAKE_SKIPPED ]] && [[ $RET2 -ne 0 ]]; then
        # return errors from the second test run
-       cleanup $RET2
+       exit $RET2
 fi
 if [[ $RET3 -ne $AUTOMAKE_SKIPPED ]] && [[ $RET3 -ne 0 ]]; then
        # return errors from the third test run
-       cleanup $RET3
+       exit $RET3
 fi
 
 if [[ $RET1 -eq 0 ]] || [[ $RET2 -eq 0 ]] || [[ $RET3 -eq 0 ]]; then
-       cleanup 0
+       exit 0
 fi
 
 if [[ $RET1 -eq $AUTOMAKE_SKIPPED ]] || [[ $RET2 -eq $AUTOMAKE_SKIPPED ]] ||
    [[ $RET3 -eq $AUTOMAKE_SKIPPED ]]; then
-       cleanup $AUTOMAKE_SKIPPED
+       exit $AUTOMAKE_SKIPPED
 fi
 
 # I don't think we should ever get here, but better safe than sorry
-cleanup $AUTOMAKE_HARD_ERROR
+exit $AUTOMAKE_HARD_ERROR