Re: headerscheck ccache support - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: headerscheck ccache support
Date
Msg-id cce91d86-bf43-46a1-9429-113fe748f70e@eisentraut.org
Whole thread Raw
In response to Re: headerscheck ccache support  (Álvaro Herrera <alvherre@kurilemu.de>)
Responses Re: headerscheck ccache support
Re: headerscheck ccache support
Re: headerscheck ccache support
List pgsql-hackers
On 21.11.25 13:14, Álvaro Herrera wrote:
>> Now ccache works.
> 
> Sounds reasonable.  I notice that you're cleaning this file in a `rm`
> line in the loop,
> 
>> @@ -253,10 +249,11 @@ do
>>       if ! $COMPILER $COMPILER_FLAGS -I $builddir -I $srcdir \
>>           -I $builddir/src/include -I $srcdir/src/include \
>>           -I $builddir/src/interfaces/libpq -I $srcdir/src/interfaces/libpq \
>> -        $EXTRAINCLUDES $EXTRAFLAGS -c $tmp/test.$ext -o $tmp/test.o
>> +        $EXTRAINCLUDES $EXTRAFLAGS -c $test_file_name.$ext -o $test_file_name.o
>>       then
>>           exit_status=1
>>       fi
>> +    rm -f "$test_file_name.$ext" "$test_file_name.o"
>>   done
> 
> but this means that if the script is interrupted halfway through, one
> file or two files might remain in place.  Would it be possible to have
> the current file name in a variable, so that the `trap` line can delete
> them?

Here is another patch set.  I have made some tweaks to address the issue 
you raise, and I took some code and inspiration from Thomas Munro's 
patch.  The solution I chose is to create a temporary subdirectory in 
the build directory, and create the test files in there.  That way the 
trap can just blow away the directory, as before.

> I've been also wondering about testing whether `parallel` is installed,
> and use that if so.

Another approach I had in mind for some time is to just write out a 
makefile with the test compile commands, and run that with make -j. 
Demo patch attached.  (I'm not seriously proposing this.  For one thing, 
we probably wouldn't want to introduce a dependency on make.  But you 
could probably write an equivalent ninja.build file.)

But this doesn't seem to buy very much.  The overhead of the shell 
script to write out the test files appears to become significant 
compared the the actual compile commands.

Another simple idea is to run headerscheck and cpluspluscheck in 
parallel.  You can already do that manually, and we could do that on CI 
to save about 50% wall-clock time.  Patch attached.

Attachment

pgsql-hackers by date:

Previous
From: Nazir Bilal Yavuz
Date:
Subject: Re: Proposal: adding --enable-shadows-warning
Next
From: Ajit Awekar
Date:
Subject: Periodic authorization expiration checks using GoAway message