OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 import unittest, os, time, re, glob, logging | 3 import unittest, os, time, re, glob, logging |
4 import common | 4 import common |
5 from autotest_lib.client.common_lib.test_utils import mock | 5 from autotest_lib.client.common_lib.test_utils import mock |
6 from autotest_lib.client.bin import kernel, job, utils, kernelexpand | 6 from autotest_lib.client.bin import kernel, job, utils, kernelexpand |
7 from autotest_lib.client.bin import kernel_config, boottool, os_dep | 7 from autotest_lib.client.bin import kernel_config, boottool, os_dep |
8 | 8 |
9 | 9 |
10 class TestAddKernelToBootLoader(unittest.TestCase): | 10 class TestAddKernelToBootLoader(unittest.TestCase): |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 self.build_dir) | 418 self.build_dir) |
419 | 419 |
420 # run and check | 420 # run and check |
421 self.kernel.get_kernel_tree(self.base_tree) | 421 self.kernel.get_kernel_tree(self.base_tree) |
422 self.god.check_playback() | 422 self.god.check_playback() |
423 | 423 |
424 | 424 |
425 def test_extraversion(self): | 425 def test_extraversion(self): |
426 self.construct_kernel() | 426 self.construct_kernel() |
427 tag = "tag" | 427 tag = "tag" |
428 # setup | |
429 self.god.stub_function(self.kernel, "config") | |
430 | 428 |
431 # record | 429 # record |
432 os.chdir.expect_call(self.build_dir) | 430 os.chdir.expect_call(self.build_dir) |
433 extraversion_sub = r's/^CONFIG_LOCALVERSION=\s*"\(.*\)"/CONFIG_LOCALVERS
ION=' | 431 extraversion_sub = r's/^EXTRAVERSION =\s*\(.*\)/EXTRAVERSION = ' |
434 cfg = self.build_dir + '/.config' | 432 p = extraversion_sub + '\\1-%s/' % tag |
435 p = extraversion_sub + '"\\1-%s"/' % tag | 433 utils.system.expect_call('mv Makefile Makefile.old') |
436 utils.system.expect_call('mv %s %s.old' % (cfg, cfg)) | 434 utils.system.expect_call('sed "%s" < Makefile.old > Makefile' % p) |
437 utils.system.expect_call("sed '%s' < %s.old > %s" % (p, cfg, cfg)) | |
438 self.kernel.config.expect_call(make='oldconfig') | |
439 | 435 |
440 # run and check | 436 # run and check |
441 self.kernel.extraversion(tag) | 437 self.kernel.extraversion(tag) |
442 self.god.check_playback() | 438 self.god.check_playback() |
443 | 439 |
444 | 440 |
445 def test_build(self): | 441 def test_build(self): |
446 self.construct_kernel() | 442 self.construct_kernel() |
447 self.god.stub_function(self.kernel, "extraversion") | 443 self.god.stub_function(self.kernel, "extraversion") |
448 self.god.stub_function(self.kernel, "set_cross_cc") | 444 self.god.stub_function(self.kernel, "set_cross_cc") |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 args, ident, expected_ident, | 639 args, ident, expected_ident, |
644 self.subdir, self.kernel.applied_patches) | 640 self.subdir, self.kernel.applied_patches) |
645 | 641 |
646 # run and check | 642 # run and check |
647 self.kernel.boot(args=args, ident=ident) | 643 self.kernel.boot(args=args, ident=ident) |
648 self.god.check_playback() | 644 self.god.check_playback() |
649 | 645 |
650 | 646 |
651 if __name__ == "__main__": | 647 if __name__ == "__main__": |
652 unittest.main() | 648 unittest.main() |
OLD | NEW |