On Sat, Mar 15, 2025 at 12:20:14PM -0500, Robert Dubner wrote:
> Details.  Easy-peasy.  I'll probably create some python scripts for doing
> it in a more general way for my directory structures, where each test is
> in its own directory.
> 
> And then for UAT I'll have to extract both the source code and expected
> results from the .AT files.  That'll just be tedious, not hard.
> 
> Additional issue, although it'll definitely be done later: 
> 
> I don't see any way of separately compiling two source modules and linking
> them together.  I have a number of test cases involving linking together
> produced-from-c.o and produced-from-cobol.o modules, because I am testing
> whether they can link properly.  And there are issues of cobol-to-cobol
> linking, since slightly different things happen when calling another
> program in a module, and calling one compiled separately.
> 
> Is there some way of doing that?

Yes.  See e.g. gcc/testsuite/gcc.dg/pr102892-{1,2}.c.
In one file you add
*> { dg-additional-sources "something-2.cob" }
and in the other either
*> { dg-do compile }
or even arrange for it to be skipped altogether.
When compiling the first test, it will just use dg-options from it
and add both the first and second test on the same command line.
The pr102892-1.c is in particular just dg-do link test (so it compiles and
links, but doesn't execute), so in testsuite/gcc/gcc.log then one can see
Executing on host: /home/jakub/src/gcc/obj36/gcc/xgcc 
-B/home/jakub/src/gcc/obj36/gcc/  
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr102892-1.c    
-fdiagnostics-plain-output   -O3  
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr102892-2.c -dumpbase ""  -lm  -o 
pr102892-1.exe    (timeout = 300)
spawn -ignore SIGHUP /home/jakub/src/gcc/obj36/gcc/xgcc 
-B/home/jakub/src/gcc/obj36/gcc/ 
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr102892-1.c 
-fdiagnostics-plain-output -O3 
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr102892-2.c -dumpbase  -lm -o 
pr102892-1.exe
PASS: gcc.dg/pr102892-1.c (test for excess errors)
Executing on host: /home/jakub/src/gcc/obj36/gcc/xgcc 
-B/home/jakub/src/gcc/obj36/gcc/  
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr102892-2.c    
-fdiagnostics-plain-output   -O3 -S -o pr102892-2.s    (timeout = 300)
spawn -ignore SIGHUP /home/jakub/src/gcc/obj36/gcc/xgcc 
-B/home/jakub/src/gcc/obj36/gcc/ 
/home/jakub/src/gcc/gcc/testsuite/gcc.dg/pr102892-2.c 
-fdiagnostics-plain-output -O3 -S -o pr102892-2.s
PASS: gcc.dg/pr102892-2.c (test for excess errors)

        Jakub

Reply via email to