Skip to content

Commit

Permalink
Update Jenkins jobs and ZenUnitDevOpsPython to hardcode Ninja and Vis…
Browse files Browse the repository at this point in the history
…ual Studio 2022
  • Loading branch information
NeilJustice committed Jan 9, 2025
1 parent 260497e commit eb13a25
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 33 deletions.
1 change: 0 additions & 1 deletion JenkinsJobs/Linux/ZenUnitAndMetalMock-Debug-Clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ set -ev
export PYTHONPATH=.
export CXX=/usr/bin/clang++
python -u ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type=Debug \
--cmake-definitions="-DFastLinuxDebugBuildMode=ON"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ set -ev
export PYTHONPATH=.
export CXX=/usr/bin/clang++
python -u ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type=Debug \
--cmake-definitions="-DClangAddressSanitizerMode=ON -DFastLinuxDebugBuildMode=ON"
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ export PYTHONPATH=.
export CXX=/usr/bin/clang++
export UBSAN_OPTIONS=halt_on_error=true
python -u ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type=Debug \
--cmake-definitions="-DClangUndefinedBehaviorSanitizerMode=ON -DFastLinuxDebugBuildMode=ON"
1 change: 0 additions & 1 deletion JenkinsJobs/Linux/ZenUnitAndMetalMock-Debug-GCC.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ set -ev
export CXX=/usr/bin/g++
export PYTHONPATH=.
python -u ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type=Debug \
--cmake-definitions="-DFastLinuxDebugBuildMode=ON"
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ set -ev

export PYTHONPATH=.
export CXX=/usr/bin/clang++

python -u ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type=Debug \
--cmake-definitions="-DFastLinuxDebugBuildMode=ON"

time valgrind --tool=callgrind \
--cache-sim=yes \
--branch-sim=yes \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -ev
export PYTHONPATH=.
export CXX=/usr/bin/clang++
python -u ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type=Debug \
--cmake-definitions="-DFastLinuxDebugBuildMode=ON"
heaptrack Debug/ZenUnitUtilsAndAssertionTests/ZenUnitUtilsAndAssertionTests --random-seed=0
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ set -ev
export CXX=/usr/bin/clang++
export PYTHONPATH=.
python -u ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type=RelWithDebInfo \
--cmake-definitions="-DFastLinuxReleaseBuildMode=ON"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ set -ev
export CXX=/usr/bin/clang++
export PYTHONPATH=.
python -u ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type=RelWithDebInfo \
--cmake-definitions="-DClangAddressSanitizerMode=ON -DFastLinuxReleaseBuildMode=ON"
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ export CXX=/usr/bin/clang++
export PYTHONPATH=.
export UBSAN_OPTIONS=halt_on_error=true
python -u ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type=RelWithDebInfo \
--cmake-definitions="-DClangUndefinedBehaviorSanitizerMode=ON -DFastLinuxReleaseBuildMode=ON"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ set -ev
export CXX=/usr/bin/g++
export PYTHONPATH=.
python -u ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py \
--cmake-generator=Ninja \
--cmake-build-type=RelWithDebInfo \
--cmake-definitions="-DFastLinuxReleaseBuildMode=ON"
1 change: 0 additions & 1 deletion JenkinsJobs/Windows/ZenUnitAndMetalMock-Debug.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$env:PYTHONPATH="."
python.exe -u ZenUnitDevOpsPython\BuildAndTestZenUnitAndMetalMock.py `
--cmake-generator="Visual Studio 17 2022" `
--cmake-build-type="Debug" `
--cmake-definitions=""
exit $LastExitCode
1 change: 0 additions & 1 deletion JenkinsJobs/Windows/ZenUnitAndMetalMock-RelWithDebInfo.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$env:PYTHONPATH="."
python.exe -u ZenUnitDevOpsPython\BuildAndTestZenUnitAndMetalMock.py `
--cmake-generator="Visual Studio 17 2022" `
--cmake-build-type="RelWithDebInfo" `
--cmake-definitions=""
exit $LastExitCode
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$env:PYTHONPATH="."
python.exe -u ZenUnitDevOpsPython\BuildAndTestZenUnitAndMetalMock.py `
--cmake-generator="Visual Studio 17 2022" `
--cmake-build-type="Debug" `
--cmake-definitions=""
if ($LastExitCode -ne 0) { exit $LastExitCode }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$env:PYTHONPATH="."
python.exe -u ZenUnitDevOpsPython\BuildAndTestZenUnitAndMetalMock.py `
--cmake-generator="Visual Studio 17 2022" `
--cmake-build-type="Debug" `
--cmake-definitions=""
if ($LastExitCode -ne 0) { exit $LastExitCode }
Expand Down
17 changes: 8 additions & 9 deletions ZenUnitDevOpsPython/BuildAndTestZenUnitAndMetalMock.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Usage: BuildAndTestZenUnitAndMetalMock.py --cmake-generator=<CMakeGenerator> --cmake-build-type=<CMakeBuildType> --cmake-definitions=<QuotedSpaceSeparatedCMakeDefinitions>"""
"""Usage: BuildAndTestZenUnitAndMetalMock.py --cmake-build-type=<CMakeBuildType> --cmake-definitions=<QuotedSpaceSeparatedCMakeDefinitions>"""
import os
import platform
import sys
Expand All @@ -10,12 +10,11 @@ def main() -> int:
runningSysArgvMessage = f'Running {sys.argv}\n'
print(runningSysArgvMessage)
docoptDictionary: docopt.Dict = docopt.docopt(__doc__)
cmakeGenerator: Any = docoptDictionary['--cmake-generator']
cmakeBuildType: Any = docoptDictionary['--cmake-build-type']
cmakeDefinitions: Any = docoptDictionary['--cmake-definitions']
platformSystem: Any = platform.system().casefold()
if platformSystem == 'linux':
linux_cmake_build(cmakeGenerator, cmakeBuildType, cmakeDefinitions)
linux_cmake_build(cmakeBuildType, cmakeDefinitions)
Process.fail_fast_run('MetalMockExamples/MetalMockExamples --test-runs=2 --random --max-test-milliseconds=200')
Process.fail_fast_run('MetalMockTests/MetalMockTests --test-runs=2 --random --max-test-milliseconds=200')
Process.fail_fast_run('ZenUnitCompileSpeedTests/ZenUnitCompileSpeedTests --test-runs=2 --random --max-test-milliseconds=200')
Expand All @@ -24,7 +23,7 @@ def main() -> int:
Process.fail_fast_run('ZenUnitUtilsAndAssertionTests/ZenUnitUtilsAndAssertionTests --test-runs=2 --random --max-test-milliseconds=200')
os.chdir('..')
else:
windows_cmake_build(cmakeGenerator, cmakeBuildType, cmakeDefinitions) # Runs all tests once randomly as post-build events
windows_cmake_build(cmakeBuildType, cmakeDefinitions) # Runs all tests once randomly as post-build events
# Run all tests randomly a second time
Process.fail_fast_run(f'MetalMockExamples/{cmakeBuildType}/MetalMockExamples.exe --random --max-test-milliseconds=200')
Process.fail_fast_run(f'MetalMockTests/{cmakeBuildType}/MetalMockTests.exe --random --max-test-milliseconds=200')
Expand All @@ -34,12 +33,12 @@ def main() -> int:
Process.fail_fast_run(f'ZenUnitUtilsAndAssertionTests/{cmakeBuildType}/ZenUnitUtilsAndAssertionTests.exe --random --max-test-milliseconds=200')
return 0

def linux_cmake_build(cmakeGenerator: str, cmakeBuildType: str, cmakeDefinitions: str) -> None:
CMake.generate(cmakeBuildType, cmakeGenerator, cmakeBuildType, cmakeDefinitions, '..')
def linux_cmake_build(cmakeBuildType: str, cmakeDefinitions: str) -> None:
CMake.generate(cmakeBuildType, 'Ninja', cmakeBuildType, cmakeDefinitions, '..')
Process.fail_fast_run('ninja -v')

def windows_cmake_build(cmakeGenerator: str, cmakeBuildType: str, cmakeDefinitions: str) -> None:
CMake.generate('.', cmakeGenerator, cmakeBuildType, cmakeDefinitions, '.')
def windows_cmake_build(cmakeBuildType: str, cmakeDefinitions: str) -> None:
CMake.generate('.', 'Visual Studio 17 2022', cmakeBuildType, cmakeDefinitions, '.')
cmakeBuildCommand = f'cmake.exe --build . --config {cmakeBuildType}'
Process.fail_fast_run(cmakeBuildCommand)

Expand All @@ -48,6 +47,6 @@ def windows_cmake_build(cmakeGenerator: str, cmakeBuildType: str, cmakeDefinitio
sys.exit(main())

# Example command line arguments:
# --cmake-generator="Visual Studio 17 2022" --cmake-build-type=Debug --cmake-definitions=""
# --cmake-build-type=Debug --cmake-definitions=""
# Working directory:
# D:\Code\ZenUnitAndMetalMock
2 changes: 1 addition & 1 deletion ZenUnitDevOpsPython/ZenUnitDevOpsPython.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Name>ZenUnitDevOpsPython</Name>
<RootNamespace>ZenUnitDevOpsPython</RootNamespace>
<LaunchProvider>Standard Python launcher</LaunchProvider>
<CommandLineArguments>--cmake-generator="Visual Studio 17 2022" --cmake-build-type=Debug --cmake-definitions=""</CommandLineArguments>
<CommandLineArguments>--cmake-build-type=Debug --cmake-definitions=""</CommandLineArguments>
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
<IsWindowsApplication>False</IsWindowsApplication>
<WorkingDirectory>D:\Code\ZenUnitAndMetalMock</WorkingDirectory>
Expand Down
16 changes: 7 additions & 9 deletions ZenUnitDevOpsPythonTests/BuildAndTestZenUnitAndMetalMockTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
class BuildZenUnitTests(unittest.TestCase):

def setUp(self):
self.cmakeGenerator = Random.string()
self.cmakeBuildType = Random.string()
self.cmakeDefinitions = Random.string()

def test_docstring__IsExpectedString(self):
self.assertEqual("""Usage: BuildAndTestZenUnitAndMetalMock.py --cmake-generator=<CMakeGenerator> --cmake-build-type=<CMakeBuildType> --cmake-definitions=<QuotedSpaceSeparatedCMakeDefinitions>""", BuildAndTestZenUnitAndMetalMock.__doc__)
self.assertEqual("""Usage: BuildAndTestZenUnitAndMetalMock.py --cmake-build-type=<CMakeBuildType> --cmake-definitions=<QuotedSpaceSeparatedCMakeDefinitions>""", BuildAndTestZenUnitAndMetalMock.__doc__)

def test_main_CMakesZenUnitAndMetalMock_BuildsZenUnitAndMetalMock_RunsAllUnitTestBinaries_Returns0(self):
@patch('docopt.docopt', spec_set=True)
Expand All @@ -36,7 +35,6 @@ def testcase(platformSystem, expectLinux, printMock, _1, _2, _3, _4, _5, _6):
with self.subTest(f'{platformSystem}, {expectLinux}'):
docopt.docopt.return_value =\
{
'--cmake-generator': self.cmakeGenerator,
'--cmake-build-type': self.cmakeBuildType,
'--cmake-definitions': self.cmakeDefinitions
}
Expand All @@ -49,7 +47,7 @@ def testcase(platformSystem, expectLinux, printMock, _1, _2, _3, _4, _5, _6):
docopt.docopt.assert_called_once_with(BuildAndTestZenUnitAndMetalMock.__doc__)
platform.system.assert_called_once_with()
if expectLinux:
BuildAndTestZenUnitAndMetalMock.linux_cmake_build.assert_called_once_with(self.cmakeGenerator, self.cmakeBuildType, self.cmakeDefinitions)
BuildAndTestZenUnitAndMetalMock.linux_cmake_build.assert_called_once_with(self.cmakeBuildType, self.cmakeDefinitions)
self.assertEqual(6, len(Process.fail_fast_run.call_args_list))
Process.fail_fast_run.assert_has_calls([
call('MetalMockExamples/MetalMockExamples --test-runs=2 --random --max-test-milliseconds=200'),
Expand All @@ -60,7 +58,7 @@ def testcase(platformSystem, expectLinux, printMock, _1, _2, _3, _4, _5, _6):
call('ZenUnitUtilsAndAssertionTests/ZenUnitUtilsAndAssertionTests --test-runs=2 --random --max-test-milliseconds=200')])
os.chdir.assert_called_once_with('..')
else:
BuildAndTestZenUnitAndMetalMock.windows_cmake_build.assert_called_once_with(self.cmakeGenerator, self.cmakeBuildType, self.cmakeDefinitions)
BuildAndTestZenUnitAndMetalMock.windows_cmake_build.assert_called_once_with(self.cmakeBuildType, self.cmakeDefinitions)
Process.fail_fast_run.assert_has_calls([
call(f'MetalMockExamples/{self.cmakeBuildType}/MetalMockExamples.exe --random --max-test-milliseconds=200'),
call(f'MetalMockTests/{self.cmakeBuildType}/MetalMockTests.exe --random --max-test-milliseconds=200'),
Expand All @@ -81,9 +79,9 @@ def test_linux_cmake_and_build_RunsCMakes_RunsNinja(self):
def testcase(cmakeDefinitions, expectedCMakeDefinitionsArgument, _1, _2):
with self.subTest(f'{cmakeDefinitions, expectedCMakeDefinitionsArgument}'):
#
BuildAndTestZenUnitAndMetalMock.linux_cmake_build(self.cmakeGenerator, self.cmakeBuildType, cmakeDefinitions)
BuildAndTestZenUnitAndMetalMock.linux_cmake_build(self.cmakeBuildType, cmakeDefinitions)
#
CMake.generate.assert_called_once_with(self.cmakeBuildType, self.cmakeGenerator, self.cmakeBuildType, expectedCMakeDefinitionsArgument, '..')
CMake.generate.assert_called_once_with(self.cmakeBuildType, 'Ninja', self.cmakeBuildType, expectedCMakeDefinitionsArgument, '..')
Process.fail_fast_run.assert_called_once_with('ninja -v')
testcase('', '')
testcase('-DOptionA=ON', '-DOptionA=ON')
Expand All @@ -95,9 +93,9 @@ def test_windows_cmake_build_RunsCMakes_RunsCMakeBuildToRunMSBuild(self):
def testcase(cmakeDefinitions, expectedCMakeDefinitionsArgument, _1, _2):
with self.subTest(f'{cmakeDefinitions, expectedCMakeDefinitionsArgument, }'):
#
BuildAndTestZenUnitAndMetalMock.windows_cmake_build(self.cmakeGenerator, self.cmakeBuildType, cmakeDefinitions)
BuildAndTestZenUnitAndMetalMock.windows_cmake_build(self.cmakeBuildType, cmakeDefinitions)
#
CMake.generate.assert_called_once_with('.', self.cmakeGenerator, self.cmakeBuildType, expectedCMakeDefinitionsArgument, '.')
CMake.generate.assert_called_once_with('.', 'Visual Studio 17 2022', self.cmakeBuildType, expectedCMakeDefinitionsArgument, '.')
expectedCMakeBuildCommand = f'cmake.exe --build . --config {self.cmakeBuildType}'
Process.fail_fast_run.assert_called_once_with(expectedCMakeBuildCommand)
testcase('', '')
Expand Down

0 comments on commit eb13a25

Please sign in to comment.