From 118a090daa908f03ab91b69fbc3363bb7cfdd9cc Mon Sep 17 00:00:00 2001 From: Victor Gaydov Date: Sat, 13 Jul 2024 11:07:19 +0400 Subject: [PATCH] gh-511: Add "scons selftest" --- .github/workflows/build.yml | 7 +++++-- SConstruct | 7 ++++++- scripts/ci_checks/linux-checks/check-scons.sh | 5 +++++ scripts/scons_plugin/commands.py | 7 +++++++ 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100755 scripts/ci_checks/linux-checks/check-scons.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6f03701b..c2224fdea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -162,10 +162,10 @@ jobs: fail-fast: false matrix: include: - - script: linux-checks/conditional-build + - script: linux-checks/static-shared image: rocstreaming/env-ubuntu:nolibs - - script: linux-checks/static-shared + - script: linux-checks/conditional-build image: rocstreaming/env-ubuntu:nolibs - script: linux-checks/debug-build @@ -180,6 +180,9 @@ jobs: - script: linux-checks/check-formatting image: rocstreaming/env-ubuntu + - script: linux-checks/check-scons + image: rocstreaming/env-ubuntu + - script: linux-checks/pulseaudio-versions image: rocstreaming/env-ubuntu diff --git a/SConstruct b/SConstruct index 5f3fa40ce..f5f697ec1 100644 --- a/SConstruct +++ b/SConstruct @@ -439,8 +439,13 @@ doc_env = env.DeepClone() doc_env.SConscript('docs/SConscript', duplicate=0, exports='doc_env') +# run scons self-test +env.AlwaysBuild(env.Alias('selftest', [], [ + env.SelfTest(), +])) + # exit early if there is nothing to build -non_build_targets = ['fmt', 'docs', 'sphinx', 'doxygen'] +non_build_targets = ['fmt', 'docs', 'sphinx', 'doxygen', 'selftest'] if set(COMMAND_LINE_TARGETS) \ and set(COMMAND_LINE_TARGETS).intersection(non_build_targets) == set(COMMAND_LINE_TARGETS): Return() diff --git a/scripts/ci_checks/linux-checks/check-scons.sh b/scripts/ci_checks/linux-checks/check-scons.sh new file mode 100755 index 000000000..959ec99e7 --- /dev/null +++ b/scripts/ci_checks/linux-checks/check-scons.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -euo pipefail + +scons -Q selftest diff --git a/scripts/scons_plugin/commands.py b/scripts/scons_plugin/commands.py index a2a4079f2..357214b7e 100644 --- a/scripts/scons_plugin/commands.py +++ b/scripts/scons_plugin/commands.py @@ -33,6 +33,12 @@ def HeaderFormat(env, src_dir): src_dir=quote(env.Dir(src_dir).path)), env.PrettyCommand('FMT', env.Dir(src_dir).path, 'yellow')) +def SelfTest(env): + return env.Action( + '{python} scripts/scons_helpers/build-3rdparty.py --self-test'.format( + python=quote(env.GetPythonExecutable())), + env.PrettyCommand('TEST', 'build-3rdparty.py', 'green')) + def Doxygen(env, build_dir='', html_dir=None, config='', sources=[], werror=False): target = os.path.join(build_dir, 'commit') @@ -291,6 +297,7 @@ def noop(target, source, env): def init(env): env.AddMethod(ClangFormat, 'ClangFormat') env.AddMethod(HeaderFormat, 'HeaderFormat') + env.AddMethod(SelfTest, 'SelfTest') env.AddMethod(Doxygen, 'Doxygen') env.AddMethod(Sphinx, 'Sphinx') env.AddMethod(Ragel, 'Ragel')