Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'gcc/testsuite/rust/link/link.exp': Fix 'runtest_file_p' usage #1404

Merged
merged 1 commit into from
Jul 20, 2022

Conversation

tschwinge
Copy link
Member

The recent commit 418aef1
"Support extern crate" (merged in
commit fd2bd65 "Merge #1362"), added
'gcc/testsuite/rust/link/link.exp', which I understand to be a hacked up
variant of the LTO multi-file testing harness (not reviewed in detail).

Since that commit, there are issues in parallel testing, so that, for example
with:

$ make -j12 check-rust RUNTESTFLAGS='--target_board=unix\{,-m32,-mx32\}'

..., the first variant does test as expected:

@@ -6490,9 +6490,31 @@ PASS: rust/execute/torture/trait9.rs   -Os   at line 13 (test for warnings, line
 PASS: rust/execute/torture/trait9.rs   -Os  (test for excess errors)
 PASS: rust/execute/torture/trait9.rs   -Os  execution test
 PASS: rust/execute/torture/trait9.rs   -Os  output pattern test
+Running /home/thomas/tmp/source/gcc/rust/build/trace-slim/source-gcc/gcc/testsuite/rust/link/link.exp ...
+PASS: rust/link/generic_function_0.rs   -O0  (test for excess errors)
+[...]
+PASS: rust/link/trait_import_0.rs   -Os  (test for excess errors)
                === rust Summary for unix ===

-# of expected passes           6445
+# of expected passes           6466
 # of expected failures         31

..., but we then get undesired changes for the second and following variants:

 Running target unix/-m32
 Running /home/thomas/tmp/source/gcc/rust/build/trace-slim/source-gcc/gcc/testsuite/rust/compile/compile.exp ...
 PASS: rust/compile/abi-options1.rs  at line 2 (test for errors, line 1)
 PASS: rust/compile/abi-options1.rs  at line 7 (test for errors, line 6)
 PASS: rust/compile/abi-options1.rs (test for excess errors)
-PASS: rust/compile/array3.rs  at line 2 (test for warnings, line 1)
-PASS: rust/compile/array3.rs (test for excess errors)
-PASS: rust/compile/array_empty_list.rs  at line 3 (test for errors, line 2)
-PASS: rust/compile/array_empty_list.rs (test for excess errors)
-PASS: rust/compile/arrays1.rs  (test for errors, line 3)
-PASS: rust/compile/arrays1.rs (test for excess errors)
 PASS: rust/compile/arrays2.rs  at line 4 (test for errors, line 3)
 PASS: rust/compile/arrays2.rs (test for excess errors)
 PASS: rust/compile/attr-mismatch-crate-name.rs (test for excess errors)
@@ -8355,110 +8371,215 @@ PASS: rust/compile/torture/generics17.rs   -O3 -g  (test for excess errors)
 PASS: rust/compile/torture/generics17.rs   -Os   at line 18 (test for warnings, line 17)
 PASS: rust/compile/torture/generics17.rs   -Os  (test for excess errors)
 PASS: rust/compile/torture/generics18.rs   -O0   at line 19 (test for warnings, line 18)
+PASS: rust/compile/torture/generics18.rs   -O0   at line 19 (test for warnings, line 18)
+PASS: rust/compile/torture/generics18.rs   -O0   at line 5 (test for warnings, line 4)
 PASS: rust/compile/torture/generics18.rs   -O0   at line 5 (test for warnings, line 4)
 PASS: rust/compile/torture/generics18.rs   -O0  (test for excess errors)
+PASS: rust/compile/torture/generics18.rs   -O0  (test for excess errors)

..., and so on.

This has been determined to be due to repetitive 'runtest_file_p' calls (it's
a mess...), thusly fixed (some would call it a "hack", no doubt), and verified
that, for example:

$ make -j12 check-rust RUNTESTFLAGS='--target_board=unix\{,-m32,-mx32\} link.exp=simple_function_0.rs'

... only runs the one test as indicated.

The recent commit 418aef1
"Support extern crate" (merged in
commit fd2bd65 "Merge #1362"), added
'gcc/testsuite/rust/link/link.exp', which I understand to be a hacked up
variant of the LTO multi-file testing harness (not reviewed in detail).

Since that commit, there are issues in parallel testing, so that, for example
with:

    $ make -j12 check-rust RUNTESTFLAGS='--target_board=unix\{,-m32,-mx32\}'

..., the first variant does test as expected:

    @@ -6490,9 +6490,31 @@ PASS: rust/execute/torture/trait9.rs   -Os   at line 13 (test for warnings, line
     PASS: rust/execute/torture/trait9.rs   -Os  (test for excess errors)
     PASS: rust/execute/torture/trait9.rs   -Os  execution test
     PASS: rust/execute/torture/trait9.rs   -Os  output pattern test
    +Running /home/thomas/tmp/source/gcc/rust/build/trace-slim/source-gcc/gcc/testsuite/rust/link/link.exp ...
    +PASS: rust/link/generic_function_0.rs   -O0  (test for excess errors)
    +[...]
    +PASS: rust/link/trait_import_0.rs   -Os  (test for excess errors)
                    === rust Summary for unix ===

    -# of expected passes           6445
    +# of expected passes           6466
     # of expected failures         31

..., but we then get undesired changes for the second and following variants:

     Running target unix/-m32
     Running /home/thomas/tmp/source/gcc/rust/build/trace-slim/source-gcc/gcc/testsuite/rust/compile/compile.exp ...
     PASS: rust/compile/abi-options1.rs  at line 2 (test for errors, line 1)
     PASS: rust/compile/abi-options1.rs  at line 7 (test for errors, line 6)
     PASS: rust/compile/abi-options1.rs (test for excess errors)
    -PASS: rust/compile/array3.rs  at line 2 (test for warnings, line 1)
    -PASS: rust/compile/array3.rs (test for excess errors)
    -PASS: rust/compile/array_empty_list.rs  at line 3 (test for errors, line 2)
    -PASS: rust/compile/array_empty_list.rs (test for excess errors)
    -PASS: rust/compile/arrays1.rs  (test for errors, line 3)
    -PASS: rust/compile/arrays1.rs (test for excess errors)
     PASS: rust/compile/arrays2.rs  at line 4 (test for errors, line 3)
     PASS: rust/compile/arrays2.rs (test for excess errors)
     PASS: rust/compile/attr-mismatch-crate-name.rs (test for excess errors)
    @@ -8355,110 +8371,215 @@ PASS: rust/compile/torture/generics17.rs   -O3 -g  (test for excess errors)
     PASS: rust/compile/torture/generics17.rs   -Os   at line 18 (test for warnings, line 17)
     PASS: rust/compile/torture/generics17.rs   -Os  (test for excess errors)
     PASS: rust/compile/torture/generics18.rs   -O0   at line 19 (test for warnings, line 18)
    +PASS: rust/compile/torture/generics18.rs   -O0   at line 19 (test for warnings, line 18)
    +PASS: rust/compile/torture/generics18.rs   -O0   at line 5 (test for warnings, line 4)
     PASS: rust/compile/torture/generics18.rs   -O0   at line 5 (test for warnings, line 4)
     PASS: rust/compile/torture/generics18.rs   -O0  (test for excess errors)
    +PASS: rust/compile/torture/generics18.rs   -O0  (test for excess errors)

..., and so on.

This has been determined to be due to repetitive 'runtest_file_p' calls (it's
a mess...), thusly fixed (some would call it a "hack", no doubt), and verified
that, for example:

    $ make -j12 check-rust RUNTESTFLAGS='--target_board=unix\{,-m32,-mx32\} link.exp=simple_function_0.rs'

... only runs the one test as indicated.
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for looking into this for me. I hacked this up and I should really write up what its doing in here.

The idea is that the files named _0.rs are the main files and the _1.rs are compiled to objects first so that it generates crate metadata that the _0.rs file can read this metadata so extern crate works etc.

I feel like this test harness is missing the torture options on compiling the object file and any possible test annotations are ignored also which isn't great. I wasn't able to follow the code from the LTO test harness to actually link the objects together as well.

@philberty
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 20, 2022

Build succeeded:

@bors bors bot merged commit 3f5fc21 into master Jul 20, 2022
@tschwinge tschwinge deleted the tschwinge/1362-runtest_file_p branch July 20, 2022 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants