@@ -41,6 +41,7 @@ def __init__(self, machine):
4141 self .prompt = None
4242 self .user = 'root'
4343 self .password = None
44+ self .expected_release = None
4445
4546 def machine_is (self , needle ):
4647 return self .machine .startswith (needle )
@@ -70,7 +71,7 @@ def configure_from_args(self, orig_args):
7071 parser .add_argument ('--mount' , dest = 'mounts' , type = str , default = [], action = 'append' , help = 'Host mount points' )
7172 parser .add_argument ('--mount-cmd' , dest = 'mount_command' , type = str , help = "Command to run in mount point (default 'run')" )
7273 parser .add_argument ('--cmdline' , type = str , help = 'Kernel command line arguments' )
73-
74+ parser . add_argument ( '--release-path' , type = str , help = 'Path to kernel.release' )
7475 args = parser .parse_args (orig_args )
7576
7677 if args .gdb :
@@ -110,13 +111,20 @@ def configure_from_args(self, orig_args):
110111 if args .cmdline :
111112 self .cmdline .append (args .cmdline )
112113
114+ if args .release_path :
115+ self .expected_release = read_expected_release (args .release_path )
116+
113117 self .compat_rootfs = args .compat_rootfs
114118 self .use_vof = args .use_vof
115119 self .quiet = args .quiet
116120 self .net_tests = args .net_tests
117121 self .host_mounts .extend (args .mounts )
118122
119123 def apply_defaults (self ):
124+ if not self .expected_release :
125+ logging .error ("Couldn't find kernel.release" )
126+ return
127+
120128 if self .machine_is ('pseries' ):
121129 if self .accel == 'tcg' :
122130 self .machine_caps += ['cap-htm=off' ]
@@ -484,6 +492,7 @@ def qemu_main(qconf):
484492 p .push_prompt (qconf .prompt )
485493 qconf .boot_func (p , boot_timeout , qconf )
486494
495+ logging .info (f'Looking for kernel version: { qconf .expected_release } ' )
487496 p .send ('echo "booted-revision: `uname -r`"' )
488497 p .expect (f'booted-revision: { qconf .expected_release } ' )
489498 p .expect_prompt ()
0 commit comments