[libc builder] Add custom step for AOR tests.

Summary:
Add customer step to non-asan buildbot to run `make check`. These tests from AOR are meant to act as regression tests until AORs are merged into libc.

Tested locally.

Reviewers: sivachandra

Reviewed By: sivachandra

Tags: #libc-project, #zorg

Differential Revision: https://reviews.llvm.org/D76331
diff --git a/zorg/buildbot/builders/annotated/libc-linux.py b/zorg/buildbot/builders/annotated/libc-linux.py
index 80fe6b8..497dd04 100644
--- a/zorg/buildbot/builders/annotated/libc-linux.py
+++ b/zorg/buildbot/builders/annotated/libc-linux.py
@@ -1,7 +1,11 @@
 #!/usr/bin/python
 
 import os
+import subprocess
 import sys
+import traceback
+import util
+from contextlib import contextmanager
 import annotated_builder
 
 
@@ -22,6 +26,35 @@
                       check_targets=check_targets,
                       extra_cmake_args=extra_cmake_args)
 
+    # AOR tests step
+    if not args.asan:
+        with step('AOR Tests'):
+            aor_dir = os.path.join('..', 'llvm-project', 'libc', 'AOR_v20.02')
+            run_command(['make', 'check'], directory=aor_dir)
+
+
+@contextmanager
+def step(step_name, halt_on_fail=True):
+    util.report('@@@BUILD_STEP {}@@@'.format(step_name))
+    if halt_on_fail:
+        util.report('@@@HALT_ON_FAILURE@@@')
+    try:
+        yield
+    except Exception as e:
+        if isinstance(e, subprocess.CalledProcessError):
+            util.report(
+                '{} exited with return code {}.'.format(e.cmd, e.returncode)
+            )
+        util.report('The build step threw an exception...')
+        traceback.print_exc()
+
+        util.report('@@@STEP_FAILURE@@@')
+    finally:
+        sys.stdout.flush()
+
+def run_command(cmd, directory='.'):
+    util.report_run_cmd(cmd, cwd=directory)
+
 
 if __name__ == '__main__':
     sys.path.append(os.path.dirname(__file__))