blob: eb82ca662103b39a8709aa7cb0a199eb62dd0e26 [file] [log] [blame]
from modules.llvm import run_test_suite
import os
from unittest import TestCase
from unittest.mock import MagicMock
class TestRunTestSuite(TestCase):
def test_default_run(self):
"""Test that we can run the test-suite without any custom flags."""
sandbox = "path/to/sandbox"
testsuite = "path/to/testsuite"
lit = "path/to/lit"
consumer = MagicMock()
run_test_suite(consumer, sandbox, testsuite, lit)
command, directory = consumer.consume.call_args[0]
self.assertIsNone(directory)
self.assertEqual(
command,
[
os.path.join(sandbox, "bin", "python"),
os.path.join(sandbox, "bin", "lnt"),
"runtest",
"test-suite",
"--sandbox={}".format(sandbox),
"--test-suite={}".format(testsuite),
"--use-lit={}".format(lit),
])
def test_run_with_flags(self):
"""Test that we can run the test-suite with custom flags."""
sandbox = "path/to/sandbox"
testsuite = "path/to/testsuite"
lit = "path/to/lit"
consumer = MagicMock()
run_test_suite(consumer, sandbox, testsuite, lit,
["--cc", "path/to/clang", "--cxx", "path/to/clang++",
"--threads=4", "--build-threads=1"])
command, directory = consumer.consume.call_args[0]
self.assertIsNone(directory)
self.assertEqual(
command,
[
os.path.join(sandbox, "bin", "python"),
os.path.join(sandbox, "bin", "lnt"),
"runtest",
"test-suite",
"--sandbox={}".format(sandbox),
"--test-suite={}".format(testsuite),
"--use-lit={}".format(lit),
"--cc", "path/to/clang",
"--cxx", "path/to/clang++",
"--threads=4",
"--build-threads=1",
])