The Meson Build System http://mesonbuild.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

run_cross_test.py 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/env python3
  2. # Copyright 2013-2016 The Meson development team
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. # Unless required by applicable law or agreed to in writing, software
  8. # distributed under the License is distributed on an "AS IS" BASIS,
  9. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. # See the License for the specific language governing permissions and
  11. # limitations under the License.
  12. '''Runs the basic test suite through a cross compiler.
  13. Not part of the main test suite because of two reasons:
  14. 1) setup of the cross build is platform specific
  15. 2) it can be slow (e.g. when invoking test apps via wine)
  16. Eventually migrate to something fancier.'''
  17. import sys
  18. import os
  19. from pathlib import Path
  20. import argparse
  21. from run_project_tests import gather_tests, run_tests, StopException, setup_commands
  22. from run_project_tests import failing_logs
  23. def runtests(cross_file, failfast):
  24. commontests = [('common', gather_tests(Path('test cases', 'common')), False)]
  25. try:
  26. (passing_tests, failing_tests, skipped_tests) = \
  27. run_tests(commontests, 'meson-cross-test-run', failfast, ['--cross-file', cross_file])
  28. except StopException:
  29. pass
  30. print('\nTotal passed cross tests:', passing_tests)
  31. print('Total failed cross tests:', failing_tests)
  32. print('Total skipped cross tests:', skipped_tests)
  33. if failing_tests > 0 and ('CI' in os.environ):
  34. print('\nMesonlogs of failing tests\n')
  35. for log in failing_logs:
  36. print(log, '\n')
  37. return failing_tests
  38. def main():
  39. parser = argparse.ArgumentParser()
  40. parser.add_argument('--failfast', action='store_true')
  41. parser.add_argument('cross_file')
  42. options = parser.parse_args()
  43. setup_commands('ninja')
  44. return runtests(options.cross_file, options.failfast)
  45. if __name__ == '__main__':
  46. sys.exit(main())