rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.27k stars 12.71k forks source link

No way to disable tests for `*-windows-gnu` but keep them enabled for `*-windows-gnullvm` #132278

Open mati865 opened 1 week ago

mati865 commented 1 week ago

If I write:

//@ only-windows
//@ ignore-windows-gnu // or just ignore-gnu

Then gnullvm will be also excluded. There are few things (like CFGuad) that will probably never work with mingw-w64+GNU targets but are supported on mingw-w64+LLVM (not yet within Rust). Using //@ only-windows-gnullvm won't be an option because it would disable the test for *-windows-msvc.

One idea I can think of is to add $ character that means end of the line, just like in regex. So //@ ignore-windows-gnu$ would skip all *-windows-gnu targets from the given test but keep *-windows-gnullvm targets.

Originally posted by @mati865 in #128602 cc @jieyouxu

mati865 commented 1 week ago

@rustbot modify labels: +A-compiletest

jieyouxu commented 1 week ago

I'll double-check the target matchers, matching on a substring seems somewhat sus here.

mati865 commented 1 week ago

I had tried that with quite dusted branch, so maybe it has changed since then. I'll try with a recent master.

mati865 commented 1 week ago

Yeah, that's right. On top of 2dece5bb commit, modifying the test to use:

//@ only-windows
//@ ignore-windows-gnu

shows test [codegen] tests\codegen\cfguard-checks.rs ... ignored, ignored when the operating system and target environment are windows-gnu.

Verbose configuration ``` running: "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\llvm\\bin\\llvm-config.exe" "--components" (failure_mode=Exit) (created at src\core\build_steps\test.rs:1949:21, executed at src\core\build_steps\test.rs:1949:63) Testing stage1 compiletest suite=codegen mode=codegen (x86_64-pc-windows-gnullvm) running: "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\stage0-tools-bin\\compiletest.exe" "--compile-lib-path" "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\stage1\\bin" "--run-lib-path" "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\stage1\\lib\\rustlib\\x86_64-pc-windows-gnullvm\\lib" "--rustc-path" "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\stage1\\bin\\rustc.exe" "--src-base" "H:\\projects\\rust\\tests\\codegen" "--build-base" "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\test\\codegen" "--sysroot-base" "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\stage1" "--stage-id" "stage1-x86_64-pc-windows-gnullvm" "--suite" "codegen" "--mode" "codegen" "--target" "x86_64-pc-windows-gnullvm" "--host" "x86_64-pc-windows-gnullvm" "--llvm-filecheck" "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\llvm\\build\\bin\\FileCheck.exe" "--optimize-tests" "--host-rustcflags" "-Crpath" "--host-rustcflags" "-Cdebuginfo=0" "--host-rustcflags" "-Lnative=H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\native\\rust-test-helpers" "--target-rustcflags" "-Crpath" "--target-rustcflags" "-Cdebuginfo=0" "--target-rustcflags" "-Lnative=H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\native\\rust-test-helpers" "--python" "H:/msys64/clang64/bin/python3.exe" "--lldb-version" "lldb version 18.1.8\n" "--lldb-python-dir" "H:\\msys64\\clang64\\lib\\python3.11\\site-packages" "cfguard-checks.rs" "--verbose" "--json" "--llvm-version" "19.1.1-rust-dev" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen codegendata codegentypes core coroutines coverage csky cskyasmparser cskycodegen cskydesc cskydisassembler cskyinfo debuginfobtf debuginfocodeview debuginfodwarf debuginfogsym debuginfologicalview debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwarflinkerclassic dwarflinkerparallel dwp engine executionengine extensions filecheck frontenddriver frontendhlsl frontendoffloading frontendopenacc frontendopenmp fuzzercli fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo hipstdpar instcombine instrumentation interfacestub interpreter ipo irprinter irreader jitlink libdriver lineeditor linker loongarch loongarchasmparser loongarchcodegen loongarchdesc loongarchdisassembler loongarchinfo lto m68k m68kasmparser m68kcodegen m68kdesc m68kdisassembler m68kinfo mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts objcopy object objectyaml option orcdebugging orcjit orcshared orctargetprocess passes powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvtargetmca runtimedyld sandboxir scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target targetparser textapi textapibinaryreader transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo webassemblyutils windowsdriver windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86targetmca xray xtensa xtensaasmparser xtensacodegen xtensadesc xtensadisassembler xtensainfo" "--cc" "" "--cxx" "" "--cflags" "" "--cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/local/tmp/work" "--android-cross-path" "" "--channel" "dev" "--git-repository" "rust-lang/rust" "--nightly-branch" "master" "--git-merge-commit-email" "bors@rust-lang.org" configuration: compile_lib_path: "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\stage1\\bin" run_lib_path: "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\stage1\\lib\\rustlib\\x86_64-pc-windows-gnullvm\\lib" rustc_path: "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\stage1\\bin\\rustc.exe" cargo_path: None rustdoc_path: None src_base: "H:\\projects\\rust\\tests\\codegen" build_base: "H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\test\\codegen" stage_id: stage1-x86_64-pc-windows-gnullvm mode: codegen run_ignored: false filters: ["cfguard-checks.rs"] skip: [] filter_exact: false force_pass_mode: (none) runner: (none) host-rustcflags: ["-Crpath", "-Cdebuginfo=0", "-Lnative=H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\native\\rust-test-helpers"] target-rustcflags: ["-Crpath", "-Cdebuginfo=0", "-Lnative=H:\\projects\\rust\\build\\x86_64-pc-windows-gnullvm\\native\\rust-test-helpers"] target: x86_64-pc-windows-gnullvm host: x86_64-pc-windows-gnullvm android-cross-path: "" adb_path: "adb" adb_test_dir: "/data/local/tmp/work" adb_device_status: false ar: ar target-linker: None host-linker: None verbose: true format: Json ```
mati865 commented 4 days ago

It's matched because this matcher https://github.com/rust-lang/rust/blob/db034cee00570a9b82ea8b9e9e95221dbd745698/src/tools/compiletest/src/header/cfg.rs#L123-L127 checks os and env but ignores abi which has its own matcher. In this case we'd need a way to somehow combine those two and ignore the test when they are both set to specific (sometimes empty) values.

Currently, supported syntax is too limited to handle that, so fixing this issue is not possible without complicating or reworking how compiletest works. Few ideas that come into mind: