]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runtests: add a runner initialization function
authorDan Fandrich <dan@coneharvesters.com>
Thu, 27 Apr 2023 21:08:41 +0000 (14:08 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Fri, 5 May 2023 07:45:43 +0000 (00:45 -0700)
This sets up the runner environment to start running tests.

Ref: #10818

tests/runner.pm
tests/runtests.pl

index feaa4e52983dc8534f886750d46e33c415a6eb2e..737f24d602539b222850b7dc246bd24dbeeb28a5 100644 (file)
@@ -36,6 +36,7 @@ BEGIN {
         checktestcmd
         prepro
         restore_test_env
+        runner_init
         runner_clearlocks
         runner_stopservers
         runner_test_preprocess
@@ -117,6 +118,28 @@ sub stderrfilename {
     return "$logdir/stderr$testnum";
 }
 
+#######################################################################
+# Initialize the runner and prepare it to run tests
+#
+sub runner_init {
+    my ($logdir)=@_;
+
+    # Set this directory as ours
+    # TODO: This will need to be uncommented once there are multiple runners
+    #$LOGDIR = $logdir;
+    mkdir("$LOGDIR/$PIDDIR", 0777);
+
+    # enable memory debugging if curl is compiled with it
+    $ENV{'CURL_MEMDEBUG'} = "$LOGDIR/$MEMDUMP";
+    $ENV{'CURL_ENTROPY'}="12345678";
+    $ENV{'CURL_FORCETIME'}=1; # for debug NTLM magic
+    $ENV{'CURL_GLOBAL_INIT'}=1; # debug curl_global_init/cleanup use
+    $ENV{'HOME'}=$pwd;
+    $ENV{'CURL_HOME'}=$ENV{'HOME'};
+    $ENV{'XDG_CONFIG_HOME'}=$ENV{'HOME'};
+    $ENV{'COLUMNS'}=79; # screen width!
+}
+
 #######################################################################
 # Check for a command in the PATH of the machine running curl.
 #
index 3958d4911e0f4b4cedf7090b4bf4017e9220ff0b..6ffa032be40b4c66cc644c7570f79575aa70f5a1 100755 (executable)
@@ -182,16 +182,6 @@ sub logmsg {
     }
 }
 
-# enable memory debugging if curl is compiled with it
-$ENV{'CURL_MEMDEBUG'} = "$LOGDIR/$MEMDUMP";
-$ENV{'CURL_ENTROPY'}="12345678";
-$ENV{'CURL_FORCETIME'}=1; # for debug NTLM magic
-$ENV{'CURL_GLOBAL_INIT'}=1; # debug curl_global_init/cleanup use
-$ENV{'HOME'}=$pwd;
-$ENV{'CURL_HOME'}=$ENV{'HOME'};
-$ENV{'XDG_CONFIG_HOME'}=$ENV{'HOME'};
-$ENV{'COLUMNS'}=79; # screen width!
-
 sub catch_zap {
     my $signame = shift;
     logmsg "runtests.pl received SIG$signame, exiting\n";
@@ -2231,7 +2221,6 @@ if ($gdbthis) {
 
 cleardir($LOGDIR);
 mkdir($LOGDIR, 0777);
-mkdir("$LOGDIR/$PIDDIR", 0777);
 
 #######################################################################
 # initialize some variables
@@ -2468,11 +2457,7 @@ sub displaylogs {
 }
 
 #######################################################################
-# Setup CI Test Run
-citest_starttestrun();
-
-#######################################################################
-# The main test-loop
+# Scan tests to find suitable candidates
 #
 
 my $failed;
@@ -2504,6 +2489,19 @@ if($listonly) {
     exit(0);
 }
 
+#######################################################################
+# Setup CI Test Run
+citest_starttestrun();
+
+#######################################################################
+# Initialize the runner to prepare to run tests
+cleardir($LOGDIR);
+mkdir($LOGDIR, 0777);
+runner_init($LOGDIR);
+
+#######################################################################
+# The main test-loop
+#
 # run through each candidate test and execute it
 foreach my $testnum (@runtests) {
     $count++;