Skip to content

Commit

Permalink
Create new test system for name resolution 2.0
Browse files Browse the repository at this point in the history
This runs the standard compile/*.rs tests
with name resolution 2.0 enabled. The exclude file
can be used to exclude tests which are not yet working
with name resolution 2.0.

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/compile.exp: New test.
	* rust/compile/nr2/exclude: New.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
  • Loading branch information
powerboat9 authored and CohenArthur committed Sep 16, 2024
1 parent f8e46bb commit 14d5be7
Show file tree
Hide file tree
Showing 2 changed files with 343 additions and 0 deletions.
69 changes: 69 additions & 0 deletions gcc/testsuite/rust/compile/nr2/compile.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright (C) 2021-2024 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.

# Compile tests, no torture testing, for name resolution 2.0
#
# These tests raise errors in the front end; torture testing doesn't apply.

# Load support procs.
load_lib rust-dg.exp

# Initialize `dg'.
dg-init

# Exclude tests which aren't passing yet
# These should be removed from the exclude file over time

set rust-nr2-exclude-fh [open $srcdir/$subdir/exclude r]
set rust-nr2-exclude-raw [lsort [split [read ${rust-nr2-exclude-fh}] "\n"]]
close ${rust-nr2-exclude-fh}

set rust-nr2-exclude ""
foreach exclude ${rust-nr2-exclude-raw} {
if [regexp {^[^#].*} $exclude] {
lappend rust-nr2-exclude $exclude
}
}

set rust-nr2-tests ""
set rust-nr2-tests-efail ""
foreach test [lsort [glob -nocomplain -tails -directory $srcdir/$subdir/.. *.rs]] {
set idx [lsearch -exact -sorted ${rust-nr2-exclude} $test]
if {$idx == -1} {
lappend rust-nr2-tests $srcdir/$subdir/../$test
} else {
lappend rust-nr2-tests-efail $srcdir/$subdir/../$test
set rust-nr2-exclude [lreplace ${rust-nr2-exclude} $idx $idx]
}
}

# Check for unused entries in the exclusion list
foreach still-exclude ${rust-nr2-exclude} {
fail "${still-exclude}: could not exclude test"
}

# Main loop.
set saved-dg-do-what-default ${dg-do-what-default}

set dg-do-what-default "compile"
dg-runtest ${rust-nr2-tests} "-frust-name-resolution-2.0" ""

# TODO: verify that rust-nr2-tests-efail would all fail

set dg-do-what-default ${saved-dg-do-what-default}

# All done.
dg-finish
274 changes: 274 additions & 0 deletions gcc/testsuite/rust/compile/nr2/exclude
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
# relies on exact source file path match
# TODO: patch this file or nr2/compile.exp to handle this
debug-diagnostics-on.rs

# main list
all-cast.rs
array3.rs
arrays1.rs
arrays2.rs
attr-mismatch-crate-name.rs
attr_deprecated.rs
attr_deprecated_2.rs
auto_trait_super_trait.rs
auto_trait_valid.rs
auto_trait_invalid.rs
bad=file-name.rs
bad_type2.rs
bounds1.rs
break-rust1.rs
break-rust2.rs
break-rust3.rs
break2.rs
break_with_value_inside_loop.rs
builtin_macro_eager1.rs
builtin_macro_eager2.rs
builtin_macro_recurse2.rs
canonical_paths1.rs
cast_generics.rs
cfg1.rs
cfg3.rs
cfg4.rs
cfg5.rs
closure_no_type_anno.rs
complex-path1.rs
complex_qualified_path_in_expr.rs
const-issue1440.rs
const1.rs
const10.rs
const3.rs
const4.rs
const5.rs
const6.rs
const8.rs
const9.rs
const_generics_1.rs
const_generics_3.rs
const_generics_4.rs
const_generics_5.rs
const_generics_6.rs
const_generics_7.rs
const_generics_8.rs
derive_empty.rs
derive_macro1.rs
derive_macro3.rs
derive_macro4.rs
derive_macro6.rs
diagnostic_underline.rs
expand_macro_qual_path_in_type.rs
expected_type_args2.rs
expected_type_args3.rs
feature_rust_attri0.rs
feature_rust_attri1.rs
for_lifetimes.rs
format_args_basic_expansion.rs
found_struct.rs
func1.rs
generic-default1.rs
generics1.rs
generics10.rs
generics11.rs
generics2.rs
generics3.rs
generics4.rs
generics5.rs
generics6.rs
generics7.rs
generics8.rs
generics9.rs
if_let_expr.rs
implicit_returns_err4.rs
infer-crate-name.rs
issue-1005.rs
issue-1006.rs
issue-1019.rs
issue-1023.rs
issue-1031.rs
issue-1034.rs
issue-1073.rs
issue-1089.rs
issue-1128.rs
issue-1129-1.rs
issue-1129-2.rs
issue-1130.rs
issue-1131.rs
issue-1152.rs
issue-1165.rs
issue-1173.rs
issue-1235.rs
issue-1237.rs
issue-1271.rs
issue-1272.rs
issue-1289.rs
issue-1383.rs
issue-1447.rs
issue-1483.rs
issue-1524.rs
issue-1589.rs
issue-1725-1.rs
issue-1725-2.rs
issue-1786.rs
issue-1813.rs
issue-1893.rs
issue-1901.rs
issue-1930.rs
issue-1981.rs
issue-2019-1.rs
issue-2019-2.rs
issue-2019-3.rs
issue-2029.rs
issue-2036.rs
issue-2037.rs
issue-2039.rs
issue-2043.rs
issue-2070.rs
issue-2105.rs
issue-2106.rs
issue-2135.rs
issue-2136-1.rs
issue-2136-2.rs
issue-2139.rs
issue-2142.rs
issue-2165.rs
issue-2166.rs
issue-2178.rs
issue-2188.rs
issue-2190-1.rs
issue-2190-2.rs
issue-2195.rs
issue-2238.rs
issue-2304.rs
issue-2330.rs
issue-2375.rs
issue-2478.rs
issue-2479.rs
issue-2514.rs
issue-2709.rs
issue-2723-1.rs
issue-2723-2.rs
issue-2772-1.rs
issue-2772-2.rs
issue-2775.rs
issue-2747.rs
issue-2782.rs
issue-2788.rs
issue-2812.rs
issue-2847-b.rs
issue-850.rs
issue-852.rs
issue-855.rs
issue-925.rs
iterators1.rs
lookup_err1.rs
macro-issue1233.rs
macro-issue1400.rs
macro13.rs
macro15.rs
macro20.rs
macro23.rs
macro40.rs
macro42.rs
macro43.rs
macro44.rs
macro50.rs
macro54.rs
macro55.rs
macro6.rs
macro9.rs
macro_rules_macro_rules.rs
macro_use1.rs
match-never-ltype.rs
match-never-rtype.rs
match1.rs
match2.rs
match3.rs
match4.rs
match5.rs
method1.rs
method2.rs
missing_constructor_fields.rs
multi_reference_type.rs
multiple_bindings1.rs
multiple_bindings2.rs
name_resolution2.rs
name_resolution4.rs
nested_generic.rs
nested_macro_use1.rs
nested_macro_use2.rs
nested_macro_use3.rs
non_member_const.rs
not_find_value_in_scope.rs
parse_associated_type_as_generic_arg.rs
parse_associated_type_as_generic_arg2.rs
parse_associated_type_as_generic_arg3.rs
parse_complex_generic_application.rs
parse_complex_generic_application2.rs
path_as_generic_arg.rs
pattern-struct.rs
privacy1.rs
privacy3.rs
privacy4.rs
privacy5.rs
privacy6.rs
privacy8.rs
privacy9.rs
proc_macro_attribute_non_function.rs
proc_macro_attribute_non_root_method.rs
proc_macro_derive_non_function.rs
proc_macro_derive_non_root_method.rs
proc_macro_non_function.rs
proc_macro_non_root_method.rs
pub_restricted_1.rs
pub_restricted_2.rs
pub_restricted_3.rs
redef_error2.rs
redef_error4.rs
redef_error5.rs
redef_error6.rs
ref_pattern_fn_param2.rs
reference1.rs
rustc_attr1.rs
rustc_const_stable.rs
self-path1.rs
self-path2.rs
shadow1.rs
sizeof-stray-infer-var-bug.rs
specify-crate-name.rs
stmt_with_block_dot.rs
struct-expr-parse.rs
trait-cycle.rs
traits1.rs
traits10.rs
traits11.rs
traits12.rs
traits2.rs
traits3.rs
traits4.rs
traits5.rs
traits6.rs
traits7.rs
traits8.rs
traits9.rs
tuple1.rs
tuple_mismatch.rs
tuple_struct1.rs
type-alias1.rs
type-bindings1.rs
unconstrained_type_param.rs
undeclared_label.rs
unsafe1.rs
unsafe10.rs
unsafe11.rs
unsafe2.rs
unsafe3.rs
unsafe6.rs
unsafe7.rs
unsafe8.rs
unsafe9.rs
use_1.rs
use_2.rs
v0-mangle1.rs
v0-mangle2.rs
while_break_expr.rs
rust-const-blog-issue.rs
negative_impls.rs

0 comments on commit 14d5be7

Please sign in to comment.