run_cast_core_tests.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env vpython3
  2. # Copyright 2022 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. """Runs an isolate bundled Cast Core integration test.
  6. If optional argument --isolated-script-test-output=[FILENAME] is passed
  7. to the script, json is written to that file in the format detailed in
  8. //docs/testing/json-test-results-format.md.
  9. If optional argument --isolated-script-test-filter=[TEST_NAMES] is passed to
  10. the script, it should be a double-colon-separated ("::") list of test names,
  11. to run just that subset of tests.
  12. This script is intended to be the base command invoked by the isolate,
  13. followed by a subsequent Python script. It could be generalized to
  14. invoke an arbitrary executable.
  15. """
  16. import json
  17. import os
  18. import sys
  19. # Add src/testing/ into sys.path for importing common without pylint errors.
  20. sys.path.append(
  21. os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
  22. from scripts import common
  23. class CastCoreIntegrationTestAdapter(common.BaseIsolatedScriptArgsAdapter):
  24. def generate_test_output_args(self, output):
  25. return ['--write-full-results-to', output]
  26. def main():
  27. adapter = CastCoreIntegrationTestAdapter()
  28. return adapter.run_test()
  29. # This is not really a "script test" so does not need to manually add
  30. # any additional compile targets.
  31. def main_compile_targets(args):
  32. json.dump([], args.output)
  33. if __name__ == '__main__':
  34. # Conform minimally to the protocol defined by ScriptTest.
  35. if 'compile_targets' in sys.argv:
  36. funcs = {
  37. 'run': None,
  38. 'compile_targets': main_compile_targets,
  39. }
  40. sys.exit(common.run_script(sys.argv[1:], funcs))
  41. sys.exit(main())