diff options
Diffstat (limited to 'tests/cli/testbuildandtest.py')
-rw-r--r-- | tests/cli/testbuildandtest.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/cli/testbuildandtest.py b/tests/cli/testbuildandtest.py index 1475958..f7996ad 100644 --- a/tests/cli/testbuildandtest.py +++ b/tests/cli/testbuildandtest.py @@ -219,6 +219,69 @@ class Testllvmbuildandtest(LLVMTestCase): commands[3], "{stage2}\$ ninja".format(stage2=buildDir2)) + def test_custom_both_stages(self): + """ + Test that we get the correct commands when trying to customize both + stage 1 and stage 2. + """ + reposDir = "path-to-repos" + sourceDir = "path-to-sources" + buildDir1 = "path-to-stage1" + buildDir2 = "path-to-stage2" + + output = self.run_with_output( + self.llvm_build_and_test( + "--dry-run", + "--repos-dir", reposDir, + "--source-dir", sourceDir, + "--stage1-build-dir", buildDir1, + "--stage1-subproject", "clang", + "--stage1-subproject", "compiler-rt", + "--stage1-cmake-def", "CMAKE_CXX_FLAGS=-marm", + "--stage1-cmake-def", "LLVM_ENABLE_ASSERTIONS=True", + "--stage1-build-flag=-j8", + "--stage2-build-dir", buildDir2, + "--stage2-subproject", "clang", + "--stage2-subproject", "libcxx", + "--stage2-cmake-def", "CMAKE_BUILD_TYPE=MinSizeRel", + "--stage2-build-flag", "check-all")) + + commands = output.splitlines() + + self.assertRegex(commands[0], + "{build}\$ cmake -G Ninja .* {sources}".format( + build=buildDir1, sources=sourceDir)) + + self.assertIn("-DLLVM_TOOL_CLANG_BUILD=ON", commands[0]) + self.assertIn("-DLLVM_TOOL_COMPILER_RT_BUILD=ON", commands[0]) + self.assertIn("-DLLVM_TOOL_LIBCXX_BUILD=OFF", commands[0]) + self.assertIn("-DLLVM_TOOL_LLDB_BUILD=OFF", commands[0]) + + self.assertIn("-DCMAKE_CXX_FLAGS=-marm", commands[0]) + self.assertIn("-DLLVM_ENABLE_ASSERTIONS=True", commands[0]) + self.assertNotIn("-DCMAKE_BUILD_TYPE=MinSizeRel", commands[0]) + + self.assertRegex(commands[1], + "{build}\$ ninja -j8".format(build=buildDir1)) + + self.assertRegex( + commands[2], "{stage2}\$ cmake -G Ninja .* " + "-DCMAKE_C_COMPILER={stage1}/bin/clang " + "-DCMAKE_CXX_COMPILER={stage1}/bin/clang\+\+ {sources}".format( + stage1=buildDir1, stage2=buildDir2, sources=sourceDir)) + + self.assertIn("-DLLVM_TOOL_CLANG_BUILD=ON", commands[2]) + self.assertIn("-DLLVM_TOOL_COMPILER_RT_BUILD=OFF", commands[2]) + self.assertIn("-DLLVM_TOOL_LIBCXX_BUILD=ON", commands[2]) + self.assertIn("-DLLVM_TOOL_LLDB_BUILD=OFF", commands[2]) + + self.assertNotIn("-DCMAKE_CXX_FLAGS=-marm", commands[2]) + self.assertNotIn("-DLLVM_ENABLE_ASSERTIONS=True", commands[2]) + self.assertIn("-DCMAKE_BUILD_TYPE=MinSizeRel", commands[2]) + + self.assertRegex( + commands[3], + "{stage2}\$ ninja check-all".format(stage2=buildDir2)) def test_stage2_and_testsuite(self): """ |