From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

httpserver-api: add --kernel_path parameter to allow running tests with 
specific kernel

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>

---
diff --git a/modules/httpserver-api/tests/basetest.py 
b/modules/httpserver-api/tests/basetest.py
--- a/modules/httpserver-api/tests/basetest.py
+++ b/modules/httpserver-api/tests/basetest.py
@@ -74,7 +74,8 @@ def is_reachable(cls):
                 return cls.is_jvm_up()
             else:
                 return True
-        except socket.error:
+        except socket.error as e:
+            print(e)
             return False
 
     def validate_path(self, api_definition, nickname, value):
@@ -127,12 +128,19 @@ def get_ca_cert_path(cls):
     def exec_os(cls):
         args = []
         if cls.config.hypervisor == 'firecracker':
-            args += [cls.config.run_script, "-l", "-m 2048M", "-n", "-c 4"]
+            args += [cls.config.run_script, "-m 2048M", "-n", "-c 4"]
+            if cls.config.kernel_path:
+               print('Using kernel at %s' % cls.config.kernel_path)
+               args += ['-k', cls.config.kernel_path]
         elif cls.config.use_sudo:
             args += ["/usr/bin/sudo", cls.config.run_script, "-n"]
         else:
             args += [cls.config.run_script, "--forward", "tcp::" + 
str(cls._client.get_port()) + "-:" + str(cls._client.get_port())]
 
+        if cls.config.kernel_path and cls.config.hypervisor != 'firecracker':
+            print('Using kernel at %s' % cls.config.kernel_path)
+            args += ['-k', '--kernel-path', cls.config.kernel_path]
+
         if cls.config.cmd:
             args += ["-e", cls.config.cmd]
 
diff --git a/modules/httpserver-api/tests/testhttpserver-api.py 
b/modules/httpserver-api/tests/testhttpserver-api.py
--- a/modules/httpserver-api/tests/testhttpserver-api.py
+++ b/modules/httpserver-api/tests/testhttpserver-api.py
@@ -19,6 +19,7 @@
 parser.add_argument('--jsondir', help='location of the json files', 
default=os.path.join(module_base, 'api-doc/listings/'))
 parser.add_argument('--test_image', help='the path to the test image')
 parser.add_argument('--hypervisor', action="store", default="qemu", 
help="choose hypervisor to run: qemu, firecracker")
+parser.add_argument('--kernel_path', action="store", help="optional path to 
kernel.elf")
 client.Client.add_arguments(parser)
 
 class test_httpserver(basetest.Basetest):

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000d5b75805a3c3b6d6%40google.com.

Reply via email to