Reduce sanitizer build set.

Change-Id: Idd5df6ff7c5b4f6bc3ccb0a335df0d332556d6ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508420
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2026-06-01 16:57:43 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 5dc37341fb
commit 201abb5cd1
2 changed files with 0 additions and 113 deletions
@@ -1,112 +0,0 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Check for a proper error when a snapshot and a runtime don't agree on which
// sanitizer they are using.
import "dart:io";
import "package:expect/expect.dart";
import "use_flag_test_helper.dart";
String find(String haystack, List<String> needles) {
for (String needle in needles) {
if (haystack.contains(needle)) {
return needle;
}
}
throw "None of ${needles.join(' ')}";
}
void checkExists(String path) {
if (!File(path).existsSync()) {
throw "$path does not exist";
}
}
main() async {
var sanitizer = find(Platform.executable, ["ASAN", "MSAN", "TSAN"]);
var mode = find(Platform.executable, ["Debug", "Release", "Product"]);
var arch = find(Platform.executable, ["X64", "ARM64", "RISCV64"]);
var out = find(Platform.executable, ["out", "xcodebuild"]);
var targetFlag = {
"ASAN": "--target_address_sanitizer",
"MSAN": "--target_memory_sanitizer",
"TSAN": "--target_thread_sanitizer",
}[sanitizer]!;
var nonePlatform = "$out/$mode$arch/vm_platform.dill";
var noneGenSnapshot = "$out/$mode$arch/gen_snapshot";
var noneJitRuntime = "$out/$mode$arch/dart";
var noneAotRuntime = "$out/$mode$arch/dartaotruntime";
var sanitizerGenSnapshot = "$out/$mode$sanitizer$arch/gen_snapshot";
var sanitizerAotRuntime = "$out/$mode$sanitizer$arch/dartaotruntime";
checkExists(noneGenSnapshot);
checkExists(noneJitRuntime);
checkExists(noneAotRuntime);
checkExists(sanitizerGenSnapshot);
checkExists(sanitizerAotRuntime);
await withTempDir('sanitizer-compatibility-test', (String tempDir) async {
var aotDill = "$tempDir/aot.dill";
var noneElf = "$tempDir/none.elf";
var sanitizerElf = "$tempDir/$sanitizer.elf";
var sanitizerElf2 = "$tempDir/${sanitizer}2.elf";
await run(noneJitRuntime, [
"pkg/vm/bin/gen_kernel.dart",
"--platform",
nonePlatform,
"--aot",
"-o",
aotDill,
"tests/language/unsorted/first_test.dart",
]);
await run(noneGenSnapshot, [
if (Platform.isMacOS) ...[
"--snapshot-kind=app-aot-macho-dylib",
"--macho=$noneElf",
] else ...[
"--snapshot-kind=app-aot-elf",
"--elf=$noneElf",
],
aotDill,
]);
await run(sanitizerGenSnapshot, [
if (Platform.isMacOS) ...[
"--snapshot-kind=app-aot-macho-dylib",
"--macho=$sanitizerElf",
] else ...[
"--snapshot-kind=app-aot-elf",
"--elf=$sanitizerElf",
],
aotDill,
]);
await run(noneGenSnapshot, [
if (Platform.isMacOS) ...[
"--snapshot-kind=app-aot-macho-dylib",
"--macho=$sanitizerElf2",
] else ...[
"--snapshot-kind=app-aot-elf",
"--elf=$sanitizerElf2",
],
targetFlag,
aotDill,
]);
await run(noneAotRuntime, [noneElf]);
await run(sanitizerAotRuntime, [sanitizerElf]);
await run(sanitizerAotRuntime, [sanitizerElf2]);
var errorLines = await runError(noneAotRuntime, [sanitizerElf]);
Expect.contains("Snapshot not compatible", errorLines[0]);
errorLines = await runError(noneAotRuntime, [sanitizerElf2]);
Expect.contains("Snapshot not compatible", errorLines[0]);
errorLines = await runError(sanitizerAotRuntime, [noneElf]);
Expect.contains("Snapshot not compatible", errorLines[0]);
});
}
-1
View File
@@ -1525,7 +1525,6 @@
"name": "build dart",
"script": "tools/build.py",
"arguments": [
"--sanitizer=none,${sanitizer}",
"runtime",
"runtime_precompiled"
]