tests: allow setting MESON_CI_JOBNAME=thirdparty

This is treated by the test harness as though unset, i.e. we do normal
skipping and don't assume we are running in Meson's own project CI.

However, it has one distinction which is that it isn't an error to set
$CI without setting $MESON_CI_JOBNAME, if it is in fact set but to the
ignored value.

This lets automated workflows such as Linux distro testing, particularly
alpine linux, set $CI or have it set for them by default, without
messing things up.

Also it has the advantage of $CI actually enabling useful benefits! We
will still assume that this thirdparty environment wants to force
verbose logging (printing testlogs, running ninja/samu with -v) and
colorize the console.
pull/10010/head
Eli Schwartz 3 years ago
parent ed262cad97
commit a580fac83a
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 7
      run_project_tests.py
  2. 2
      unittests/helpers.py

@ -282,7 +282,8 @@ class TestDef:
failing_logs: T.List[str] = []
print_debug = 'MESON_PRINT_TEST_OUTPUT' in os.environ
under_ci = 'CI' in os.environ
ci_jobname = os.environ.get('MESON_CI_JOBNAME', None)
raw_ci_jobname = os.environ.get('MESON_CI_JOBNAME', None)
ci_jobname = raw_ci_jobname if raw_ci_jobname != 'thirdparty' else None
do_debug = under_ci or print_debug
no_meson_log_msg = 'No meson-log.txt found.'
@ -1505,8 +1506,8 @@ def clear_transitive_files() -> None:
mesonlib.windows_proof_rm(str(d))
if __name__ == '__main__':
if under_ci and not ci_jobname:
raise SystemExit('Running under CI but MESON_CI_JOBNAME is not set')
if under_ci and not raw_ci_jobname:
raise SystemExit('Running under CI but $MESON_CI_JOBNAME is not set (set to "thirdparty" if you are running outside of the github org)')
setup_vsenv()

@ -17,7 +17,7 @@ from run_tests import get_fake_env
def is_ci():
if 'MESON_CI_JOBNAME' in os.environ:
if os.environ.get('MESON_CI_JOBNAME') not in {None, 'thirdparty'}:
return True
return False

Loading…
Cancel
Save