]> git.baikalelectronics.ru Git - kernel.git/commitdiff
kunit/kunit_tool_test: Test '--build_dir' option run
authorSeongJae Park <sjpark@amazon.de>
Fri, 20 Dec 2019 05:14:08 +0000 (05:14 +0000)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 23 Dec 2019 17:52:41 +0000 (10:52 -0700)
This commit adds kunit tool test for the '--build_dir' option.

Signed-off-by: SeongJae Park <sjpark@amazon.de>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Tested-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/kunit/kunit_tool_test.py

index 22f16e66b3c14f753b8438e9908d22fbed36e5e0..cba97756ac4a5479f6608dfa28062e2afcb56ae7 100755 (executable)
@@ -174,6 +174,7 @@ class KUnitMainTest(unittest.TestCase):
                kunit.main(['run'], self.linux_source_mock)
                assert self.linux_source_mock.build_reconfig.call_count == 1
                assert self.linux_source_mock.run_kernel.call_count == 1
+               self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=300)
                self.print_mock.assert_any_call(StrContains('Testing complete.'))
 
        def test_run_passes_args_fail(self):
@@ -202,5 +203,12 @@ class KUnitMainTest(unittest.TestCase):
                self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=timeout)
                self.print_mock.assert_any_call(StrContains('Testing complete.'))
 
+       def test_run_builddir(self):
+               build_dir = '.kunit'
+               kunit.main(['run', '--build_dir', build_dir], self.linux_source_mock)
+               assert self.linux_source_mock.build_reconfig.call_count == 1
+               self.linux_source_mock.run_kernel.assert_called_once_with(build_dir=build_dir, timeout=300)
+               self.print_mock.assert_any_call(StrContains('Testing complete.'))
+
 if __name__ == '__main__':
        unittest.main()