slave_test.py 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # ##### BEGIN GPL LICENSE BLOCK #####
  2. #
  3. # This program is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License
  5. # as published by the Free Software Foundation; either version 2
  6. # of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software Foundation,
  15. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. #
  17. # ##### END GPL LICENSE BLOCK #####
  18. # <pep8 compliant>
  19. import subprocess
  20. import os
  21. import sys
  22. # get builder name
  23. if len(sys.argv) < 2:
  24. sys.stderr.write("Not enough arguments, expecting builder name\n")
  25. sys.exit(1)
  26. builder = sys.argv[1]
  27. # we run from build/ directory
  28. blender_dir = '../blender.git'
  29. if "cmake" in builder:
  30. print("Automated tests are still DISABLED!")
  31. sys.exit(0)
  32. build_dir = os.path.abspath(os.path.join('..', 'build', builder))
  33. install_dir = os.path.abspath(os.path.join('..', 'install', builder))
  34. # NOTE: For quick test only to see if the approach work.
  35. # n the future must be replaced with an actual blender version.
  36. blender_version = '2.80'
  37. blender_version_dir = os.path.join(install_dir, blender_version)
  38. command_prefix = []
  39. extra_ctest_args = []
  40. if builder.startswith('win'):
  41. extra_ctest_args += ['-C', 'Release']
  42. elif builder.startswith('linux'):
  43. tokens = builder.split("_")
  44. glibc = tokens[1]
  45. if glibc == 'glibc224':
  46. deb_name = "stretch"
  47. if builder.endswith('x86_64_cmake'):
  48. chroot_name = 'buildbot_' + deb_name + '_x86_64'
  49. elif builder.endswith('i686_cmake'):
  50. chroot_name = 'buildbot_' + deb_name + '_i686'
  51. command_prefix = ['schroot', '--preserve-environment', '-c', chroot_name, '--']
  52. elif glibc == 'glibc217':
  53. command_prefix = ['scl', 'enable', 'devtoolset-6', '--']
  54. ctest_env = os.environ.copy()
  55. ctest_env['BLENDER_SYSTEM_SCRIPTS'] = os.path.join(blender_version_dir, 'scripts')
  56. ctest_env['BLENDER_SYSTEM_DATAFILES'] = os.path.join(blender_version_dir, 'datafiles')
  57. os.chdir(build_dir)
  58. retcode = subprocess.call(command_prefix + ['ctest', '--output-on-failure'] + extra_ctest_args,
  59. env=ctest_env)
  60. # Always exit with a success, for until we know all the tests are passing
  61. # on all builders.
  62. sys.exit(0)
  63. else:
  64. print("Unknown building system")
  65. sys.exit(1)