[gardening] Make test not run in obfuscated/dwarf mode

TEST=Fixes standalone/regress_53519_test in obfuscate/dwarf mode

Change-Id: I6bd87ffbc983e7a429b2c0728a09ac3ccfd6d280
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/354840
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
diff --git a/pkg/expect/lib/config.dart b/pkg/expect/lib/config.dart
index d618215..2629b18 100644
--- a/pkg/expect/lib/config.dart
+++ b/pkg/expect/lib/config.dart
@@ -31,6 +31,12 @@
 
 bool get isVmAotConfiguration => _configuration.compiler == Compiler.dartkp;
 
+bool get isVmDwarfConfiguration =>
+    _configuration.vmOptions.contains('--dwarf_stack_traces');
+
+bool get isVmObfuscateConfiguration =>
+    _configuration.vmOptions.contains('--obfuscate');
+
 bool get isVmConfiguration => isVmJitConfiguration || isVmAotConfiguration;
 
 bool get isWebConfiguration =>
diff --git a/tests/standalone/regress_53519_test.dart b/tests/standalone/regress_53519_test.dart
index 5c89b1b..fe765d1 100644
--- a/tests/standalone/regress_53519_test.dart
+++ b/tests/standalone/regress_53519_test.dart
@@ -6,6 +6,7 @@
 // Regression test for https://github.com/dart-lang/sdk/issues/53519
 
 import 'package:expect/expect.dart';
+import 'package:expect/config.dart';
 
 String destructure(Map<String, dynamic> map) {
   final {'hello': world, 'count': count} = map;
@@ -13,6 +14,10 @@
 }
 
 main() {
+  // Stringification of stack traces is only valid in non-obfuscated & non-dwarf
+  // mode.
+  if (isVmObfuscateConfiguration || isVmDwarfConfiguration) return;
+
   try {
     destructure({
       'hello': 'world',
@@ -21,7 +26,7 @@
   } catch (e, s) {
     print(s);
     // Expect that the stack trace contains an entry for the destructure
-    // function at line 11.
-    Expect.isTrue(s.toString().contains(RegExp(r'destructure \(.*:11(:3)?\)')));
+    // function at line 12.
+    Expect.isTrue(s.toString().contains(RegExp(r'destructure \(.*:12(:3)?\)')));
   }
 }