]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Fix runscript-test
authorEric Bollengier <eric@baculasystems.com>
Tue, 28 Mar 2023 07:40:27 +0000 (09:40 +0200)
committerEric Bollengier <eric@baculasystems.com>
Mon, 25 Mar 2024 12:27:34 +0000 (13:27 +0100)
Use MaximumConcurrentJobPerLevel script instead of a simplified version

regress/scripts/bacula-dir.conf.testrunscript.in
regress/tests/runscript-test

index db3af9f4fe62ef72ddfca115119fe4784aa17818..8c7f8c83c55b62bb5d0ca96aa2d8cd139d6a9d13 100644 (file)
@@ -263,7 +263,7 @@ Job {
   Maximum Concurrent Jobs = 10
   RunScript {
     RunsWhen = Queued
-    Command = "@tmpdir@/asleep.sh %c %n"
+    Command = "@tmpdir@/asleep.sh %c %l"
     failjobonerror = no
     runsonclient = no
   }
index a75e79f89259afdaa5cdf0700e21952df6e8b579..c92b96b4a44b3a187763df657681ac400fd58ca4 100755 (executable)
@@ -23,22 +23,7 @@ echo "${cwd}/build/po" >${cwd}/tmp/file-list
 
 start_test
 
-cat <<EOF > $tmp/asleep.sh
-#!/bin/sh
-
-client=\$1
-job=\$2
-sleep 5
-nb=\`$bperl -e 'get_running_jobs("$HOST-fd", "R")'\`
-if [ "\$nb" -ge 1 ]; then
-   echo Found \$nb running jobs...
-   exit 1
-else
-   echo Found 0 job...
-   exit 0
-fi
-EOF
-
+sed "s!/opt/bacula!$cwd!" $cwd/build/scripts/MaximumConcurrentJobPerLevel > $tmp/asleep.sh
 chmod +x $tmp/asleep.sh
 
 cat <<EOF > $tmp/exit.sh
@@ -239,6 +224,7 @@ $j1 = decode_json(<>);
 $j2 = decode_json(<>);
 $j3 = decode_json(<>);
 
+# Sort the 3 jobs to determine the first one
 @js = sort { $a->{data}->[0]->{starttime} cmp $b->{data}->[0]->{starttime} } ($j1, $j2, $j3);
 unless ($js[0]->{data}->[0]->{endtime} lt $js[1]->{data}->[0]->{starttime}) {
        print "1 $js[0]->{data}->[0]->{endtime} lt $js[1]->{data}->[0]->{starttime}\n";