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