Trace Tests: Add option for ASAN builds.

ASAN builds can detect OOB memory accesses. This is very useful for
diagnosing some kinds of flaky OOB crashes.

Removes a test that was calling BufferSubData with a null data
argument. This behaviour is undefined and we shouldn't be testing it.

Also includes some minor refactorings and script changes.

Bug: angleproject:5133
Change-Id: I5a7d9a5500c50a51f6369e944a5f0a533709f00d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3002510
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/capture_replay_tests.py b/src/tests/capture_replay_tests.py
index 4efcb71..671325d 100755
--- a/src/tests/capture_replay_tests.py
+++ b/src/tests/capture_replay_tests.py
@@ -258,10 +258,13 @@
         return count
 
     def RunGNGen(self, args, build_dir, pipe_stdout, extra_gn_args=[]):
-        gn_args = [("use_goma", str(args.use_goma).lower()),
-                   ("angle_with_capture_by_default", "true")] + extra_gn_args
+        gn_args = [('use_goma', str(args.use_goma).lower()),
+                   ('angle_with_capture_by_default', 'true'),
+                   ('is_debug', 'false')] + extra_gn_args
         if args.goma_dir:
             gn_args.append(('goma_dir', '"%s"' % args.goma_dir))
+        if args.asan:
+            gn_args.append(('is_asan', 'true'))
         debug('Calling GN gen with %s' % str(gn_args))
         args_str = ' '.join(['%s=%s' % (k, v) for (k, v) in gn_args])
         cmd = [self._gn_path, 'gen', '--args=%s' % args_str, build_dir]
@@ -552,9 +555,9 @@
         # CaptureReplayTests.cpp
         self.CreateTestsCompositeFiles(composite_file_id, tests)
 
-        gn_args = [("angle_build_capture_replay_tests", "true"), ("symbol_level", "1"),
-                   ("angle_capture_replay_test_trace_dir", '"%s"' % self.trace_dir),
-                   ("angle_capture_replay_composite_file_id", str(composite_file_id))]
+        gn_args = [('angle_build_capture_replay_tests', 'true'), ('symbol_level', '1'),
+                   ('angle_capture_replay_test_trace_dir', '"%s"' % self.trace_dir),
+                   ('angle_capture_replay_composite_file_id', str(composite_file_id))]
         returncode, output = child_processes_manager.RunGNGen(self.args, replay_build_dir, True,
                                                               gn_args)
         if returncode != 0:
@@ -1031,6 +1034,7 @@
     # TODO(jmadill): Remove this argument. http://anglebug.com/6102
     parser.add_argument('--depot-tools-path', default=None, help='Path to depot tools')
     parser.add_argument('--xvfb', action='store_true', help='Run with xvfb.')
+    parser.add_argument('--asan', action='store_true', help='Build with ASAN.')
     args = parser.parse_args()
     if platform == "win32":
         args.test_suite += ".exe"
diff --git a/src/tests/gl_tests/BufferDataTest.cpp b/src/tests/gl_tests/BufferDataTest.cpp
index fc83a5f..4a44b5d 100644
--- a/src/tests/gl_tests/BufferDataTest.cpp
+++ b/src/tests/gl_tests/BufferDataTest.cpp
@@ -78,36 +78,6 @@
     GLint mAttribLocation;
 };
 
-// Disabled in debug because it's way too slow.
-#if !defined(NDEBUG)
-#    define MAYBE_NULLData DISABLED_NULLData
-#else
-#    define MAYBE_NULLData NULLData
-#endif  // !defined(NDEBUG)
-
-TEST_P(BufferDataTest, MAYBE_NULLData)
-{
-    glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
-    EXPECT_GL_NO_ERROR();
-
-    const int numIterations = 128;
-    for (int i = 0; i < numIterations; ++i)
-    {
-        GLsizei bufferSize = sizeof(GLfloat) * (i + 1);
-        glBufferData(GL_ARRAY_BUFFER, bufferSize, nullptr, GL_STATIC_DRAW);
-        EXPECT_GL_NO_ERROR();
-
-        for (int j = 0; j < bufferSize; j++)
-        {
-            for (int k = 0; k < bufferSize - j; k++)
-            {
-                glBufferSubData(GL_ARRAY_BUFFER, k, j, nullptr);
-                ASSERT_GL_NO_ERROR();
-            }
-        }
-    }
-}
-
 // If glBufferData was not called yet the capturing must not try to
 // read the data. http://anglebug.com/6093
 TEST_P(BufferDataTest, Uninitialized)