run_cross_test.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. from run_project_tests import gather_tests, run_tests, StopException, setup_commands
  21. from run_project_tests import failing_logs
  22. def runtests(cross_file):
  23. commontests = [('common', gather_tests(Path('test cases', 'common')), False)]
  24. try:
  25. (passing_tests, failing_tests, skipped_tests) = run_tests(commontests, 'meson-cross-test-run', ['--cross', cross_file])
  26. except StopException:
  27. pass
  28. print('\nTotal passed cross tests:', passing_tests)
  29. print('Total failed cross tests:', failing_tests)
  30. print('Total skipped cross tests:', skipped_tests)
  31. if failing_tests > 0 and ('TRAVIS' in os.environ or 'APPVEYOR' in os.environ):
  32. print('\nMesonlogs of failing tests\n')
  33. for l in failing_logs:
  34. print(l, '\n')
  35. sys.exit(failing_tests)
  36. if __name__ == '__main__':
  37. setup_commands('ninja')
  38. cross_file = sys.argv[1]
  39. runtests(cross_file)