If we couldn't find any of the user provided configuration
items when no config file is explicitly provided, fall back
to the running kernel config, as it's more likely that we
will end up with a functional kernel at the end of the process
(defconfig might miss important modules, such as networking).

Signed-off-by: Lucas Meneghel Rodrigues <l...@redhat.com>
---
 client/kernel.py          |    2 +-
 client/kernel_config.py   |    9 ++++++---
 client/kernel_unittest.py |    2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/client/kernel.py b/client/kernel.py
index a11f2f0..6b1e090 100644
--- a/client/kernel.py
+++ b/client/kernel.py
@@ -347,7 +347,7 @@ class kernel(BootableKernel):
             utils.system("sed '%s' < %s.old > %s" % (p, cfg, cfg))
             self.config(make='oldconfig')
         else:
-            self.config(make='defconfig')
+            self.config()
 
 
     @log.record
diff --git a/client/kernel_config.py b/client/kernel_config.py
index 8429080..21d9524 100644
--- a/client/kernel_config.py
+++ b/client/kernel_config.py
@@ -69,6 +69,8 @@ class kernel_config(object):
                  defconfig=False, name=None, make=None):
         self.build_dir = build_dir
         self.config_dir = config_dir
+        self.orig_config = os.path.join(config_dir, 'config.orig')
+        self.running_config = utils.running_config()
 
         # 1. Get original config file
         self.build_config = os.path.join(build_dir, '.config')
@@ -81,10 +83,13 @@ class kernel_config(object):
                 defconf = job.config_get("kernel.default_config")
             if defconf:
                 orig_file = defconf
+            else:
+                if self.running_config is not None:
+                    orig_file = self.running_config
         if (orig_file == '' and not make and defconfig): # use defconfig
             make = 'defconfig'
         if (orig_file == '' and make): # use the config command
-            logging.debug("kernel_config: using %s to configure kernel" % make)
+            logging.debug("using %s to configure kernel" % make)
             os.chdir(build_dir)
             make_return = utils.system('make %s > /dev/null' % make)
             self.config_record(make)
@@ -92,12 +97,10 @@ class kernel_config(object):
                 raise error.TestError('make %s failed' % make)
         else:
             logging.debug("using %s to configure kernel", orig_file)
-            self.orig_config = os.path.join(config_dir, 'config.orig')
             utils.get_file(orig_file, self.orig_config)
             self.update_config(self.orig_config, self.orig_config + '.new')
             diff_configs(self.orig_config, self.orig_config + '.new')
 
-
         # 2. Apply overrides
         if overrides:
             logging.debug("using %s to re-configure kernel", overrides)
diff --git a/client/kernel_unittest.py b/client/kernel_unittest.py
index 2ac226a..699e51c 100755
--- a/client/kernel_unittest.py
+++ b/client/kernel_unittest.py
@@ -458,7 +458,7 @@ class TestKernel(unittest.TestCase):
         cfg = self.build_dir + '/.config'
         p = extraversion_sub + '"\\1-%s"/' % tag
         os.path.exists.expect_call(cfg).and_return(False)
-        self.kernel.config.expect_call(make='defconfig')
+        self.kernel.config.expect_call()
 
         # run and check
         self.kernel.extraversion(tag)
-- 
1.7.10.1

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to