build: add -Dskip-compile-errors option

Skips tests in test/cases/compile_errors.
This commit is contained in:
Alex Rønne Petersen 2025-07-23 00:23:31 +02:00
parent 761857e3f9
commit bcaae562d6
No known key found for this signature in database
2 changed files with 5 additions and 0 deletions

View File

@ -90,6 +90,7 @@ pub fn build(b: *std.Build) !void {
const skip_non_native = b.option(bool, "skip-non-native", "Main test suite skips non-native builds") orelse false;
const skip_libc = b.option(bool, "skip-libc", "Main test suite skips tests that link libc") orelse false;
const skip_single_threaded = b.option(bool, "skip-single-threaded", "Main test suite skips tests that are single-threaded") orelse false;
const skip_compile_errors = b.option(bool, "skip-compile-errors", "Main test suite skips compile error tests") orelse false;
const skip_translate_c = b.option(bool, "skip-translate-c", "Main test suite skips translate-c tests") orelse false;
const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false;
const skip_freebsd = b.option(bool, "skip-freebsd", "Main test suite skips targets with freebsd OS") orelse false;
@ -418,6 +419,7 @@ pub fn build(b: *std.Build) !void {
try tests.addCases(b, test_cases_step, target, .{
.test_filters = test_filters,
.test_target_filters = test_target_filters,
.skip_compile_errors = skip_compile_errors,
.skip_non_native = skip_non_native,
.skip_freebsd = skip_freebsd,
.skip_netbsd = skip_netbsd,

View File

@ -593,6 +593,7 @@ pub fn lowerToTranslateCSteps(
pub const CaseTestOptions = struct {
test_filters: []const []const u8,
test_target_filters: []const []const u8,
skip_compile_errors: bool,
skip_non_native: bool,
skip_freebsd: bool,
skip_netbsd: bool,
@ -618,6 +619,8 @@ pub fn lowerToBuildSteps(
if (std.mem.indexOf(u8, case.name, test_filter)) |_| break;
} else if (options.test_filters.len > 0) continue;
if (case.case.? == .Error and options.skip_compile_errors) continue;
if (options.skip_non_native and !case.target.query.isNative())
continue;