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") |
428 | 430 |
429 # record | 431 # record |
430 os.chdir.expect_call(self.build_dir) | 432 os.chdir.expect_call(self.build_dir) |
431 extraversion_sub = r's/^EXTRAVERSION =\s*\(.*\)/EXTRAVERSION = ' | 433 extraversion_sub = r's/^CONFIG_LOCALVERSION=\s*"\(.*\)"/CONFIG_LOCALVERS
ION=' |
432 p = extraversion_sub + '\\1-%s/' % tag | 434 cfg = self.build_dir + '/.config' |
433 utils.system.expect_call('mv Makefile Makefile.old') | 435 p = extraversion_sub + '"\\1-%s"/' % tag |
434 utils.system.expect_call('sed "%s" < Makefile.old > Makefile' % p) | 436 utils.system.expect_call('mv %s %s.old' % (cfg, cfg)) |
| 437 utils.system.expect_call("sed '%s' < %s.old > %s" % (p, cfg, cfg)) |
| 438 self.kernel.config.expect_call(make='oldconfig') |
435 | 439 |
436 # run and check | 440 # run and check |
437 self.kernel.extraversion(tag) | 441 self.kernel.extraversion(tag) |
438 self.god.check_playback() | 442 self.god.check_playback() |
439 | 443 |
440 | 444 |
441 def test_build(self): | 445 def test_build(self): |
442 self.construct_kernel() | 446 self.construct_kernel() |
443 self.god.stub_function(self.kernel, "extraversion") | 447 self.god.stub_function(self.kernel, "extraversion") |
444 self.god.stub_function(self.kernel, "set_cross_cc") | 448 self.god.stub_function(self.kernel, "set_cross_cc") |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 args, ident, expected_ident, | 643 args, ident, expected_ident, |
640 self.subdir, self.kernel.applied_patches) | 644 self.subdir, self.kernel.applied_patches) |
641 | 645 |
642 # run and check | 646 # run and check |
643 self.kernel.boot(args=args, ident=ident) | 647 self.kernel.boot(args=args, ident=ident) |
644 self.god.check_playback() | 648 self.god.check_playback() |
645 | 649 |
646 | 650 |
647 if __name__ == "__main__": | 651 if __name__ == "__main__": |
648 unittest.main() | 652 unittest.main() |
OLD | NEW |