jobserver: Ensure the named pipe is deleted on error

Make sure the jobserver named pipe is deleted even if the
jobserver_setup() function calls fatal() and exits early.

* src/main.c (clean_jobserver): Always reset_jobserver().
* src/posixos.c (jobserver_setup): Set job_root up front.
* tests/test_driver.pl: Print out the logfile pathname on error.
For tests with regex matches this might be the only file available.
Don't print the base filename unless one is created.
This commit is contained in:
Paul Smith 2024-12-08 16:27:06 -05:00
parent 186522e480
commit f12a4fddce
3 changed files with 9 additions and 6 deletions

View file

@ -3826,9 +3826,9 @@ clean_jobserver (int status)
ONN (error, NILF,
"INTERNAL: exiting with %u jobserver tokens available; should be %u!",
tokens, master_job_slots);
reset_jobserver ();
}
reset_jobserver ();
}
/* Exit with STATUS, cleaning up as necessary. */

View file

@ -147,6 +147,9 @@ jobserver_setup (int slots, const char *style)
{
int r;
/* This function sets up the root jobserver. */
job_root = 1;
#if JOBSERVER_USE_FIFO
if (!style || strcmp (style, "fifo") == 0)
{
@ -218,8 +221,6 @@ jobserver_setup (int slots, const char *style)
/* When using pselect() we want the read to be non-blocking. */
set_blocking (job_fds[0], 0);
job_root = 1;
return 1;
}

View file

@ -399,8 +399,9 @@ sub toplevel
++$i;
print " Failure $i:\n";
print " run: $e->{'run'}\n" if exists($e->{'run'});
print " base: $e->{'base'}\n";
print " base: $e->{'base'}\n" if exists($e->{'base'});
print " diff: $e->{'diff'}\n" if exists($e->{'diff'});
print " log: $e->{'log'}\n" if exists($e->{'log'});
}
return 0;
}
@ -1032,11 +1033,12 @@ sub compare_output
my $run = get_runfile();
my $diff = get_difffile();
my %e = ('base' => File::Spec->catdir($testpath, $base));
my %e = ('log' => File::Spec->catdir($testpath, $logfile));
if (! $matched) {
&create_file($base, $answer);
&create_file($run, $command_string);
$e{'base'} = File::Spec->catdir($testpath, $base);
$e{'run'} = File::Spec->catdir($testpath, $run);
}