mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 16:59:47 +00:00
[tests] Fix language/type_object/runtime_type_function when obfuscated.
Add the "vm:keep-name" pragma to the class whose name is checked. Add isObfuscated to guard the check that includes named parameter names, since currently they are obfuscated, even if the function is marked with the "vm:keep-name" pragma. TEST=language/type_object/runtime_type_function on vm-aot-obfuscate-linux-release-x64 Fixes: https://github.com/dart-lang/sdk/issues/53879 Cq-Include-Trybots: luci.dart.try:vm-aot-obfuscate-linux-release-x64-try Change-Id: I7698607ed6e1c95860f2e26ede923320a409eba4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332425 Reviewed-by: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
parent
6f29e7fce4
commit
e7fd34b82c
|
@ -38,3 +38,14 @@ Type print string does not match expectation
|
|||
Actual: '$type'
|
||||
""");
|
||||
}
|
||||
|
||||
const testRunnerKey = 'test_runner.configuration';
|
||||
|
||||
/// Is the test running on a test configuration with VM obfuscation enabled?
|
||||
final bool isObfuscated = (() {
|
||||
if (const bool.hasEnvironment(testRunnerKey)) {
|
||||
const config = String.fromEnvironment(testRunnerKey);
|
||||
return config.contains('obfuscate');
|
||||
}
|
||||
return false;
|
||||
})();
|
||||
|
|
|
@ -25,7 +25,12 @@ main() {
|
|||
|
||||
// Class static member tear-offs.
|
||||
check(fn('String', 'String, [String?, dynamic]'), Xyzzy.opt);
|
||||
check(fn('String', 'String', {'a': 'String?', 'b': 'dynamic'}), Xyzzy.nam);
|
||||
// TODO(dartbug.com/53879): VM obfuscation also obfuscates named parameters,
|
||||
// but currently they are not deobfuscated if the function is annotated
|
||||
// with @pragma("vm:keep-name"), just the function name.
|
||||
if (!isObfuscated) {
|
||||
check(fn('String', 'String', {'a': 'String?', 'b': 'dynamic'}), Xyzzy.nam);
|
||||
}
|
||||
|
||||
// Instance method tear-offs.
|
||||
check(fn('void', 'Object?'), new MyList<String>().add);
|
||||
|
@ -50,6 +55,7 @@ main() {
|
|||
check(fn('void', 'int'), localFunc2);
|
||||
}
|
||||
|
||||
@pragma("vm:keep-name")
|
||||
class Xyzzy {
|
||||
static void foo() {}
|
||||
static String opt(String x, [String? a, b]) => "";
|
||||
|
|
Loading…
Reference in a new issue