10
10
from lisa .executable import Tool
11
11
from lisa .messages import TestStatus , send_sub_test_result_message
12
12
from lisa .node import Node
13
- from lisa .operating_system import CBLMariner , Ubuntu
13
+ from lisa .operating_system import (
14
+ BSD , FreeBSD , OpenBSD , BMC , MacOS , CoreOs , Alpine ,
15
+ Debian , Ubuntu , RPMDistro , Fedora , Redhat , CentOs ,
16
+ Oracle , AlmaLinux , CBLMariner , Suse , SLES , NixOS , OtherLinux ,
17
+ )
14
18
from lisa .testsuite import TestResult
15
19
from lisa .tools import Cp , Git , Ls , Make , RemoteCopy , Tar
16
20
from lisa .tools .chmod import Chmod
@@ -99,27 +103,31 @@ def __init__(
99
103
# tar file path specified in yml
100
104
self ._tar_file_path = kselftest_file_path
101
105
if self ._tar_file_path :
106
+ self ._remote_tar_path = (
107
+ self .node .get_pure_path ("/tmp/kselftest" ) / os .path .basename (self ._tar_file_path )
108
+ )
109
+ self ._kself_installed_dir = (
110
+ self .node .get_pure_path ("/tmp/kselftest" ) / "kselftest-packages"
111
+ )
112
+ else :
102
113
self ._remote_tar_path = self .get_tool_path (
103
114
use_global = True
104
115
) / os .path .basename (self ._tar_file_path )
105
-
106
- # command to run kselftests
107
- self ._kself_installed_dir = (
108
- self .get_tool_path (use_global = True ) / "kselftest-packages"
109
- )
116
+ self ._kself_installed_dir = (
117
+ self .get_tool_path (use_global = True ) / "kselftest-packages"
118
+ )
110
119
111
120
self ._command = self ._kself_installed_dir / "run_kselftest.sh"
112
121
113
122
# install common dependencies
114
123
def _install (self ) -> bool :
115
- if not (
116
- (
117
- isinstance (self .node .os , Ubuntu )
118
- and self .node .os .information .version >= "18.4.0"
119
- )
120
- or isinstance (self .node .os , CBLMariner )
124
+ if (isinstance (self .node .os ,
125
+ (BSD , FreeBSD , OpenBSD , BMC , MacOS , CoreOs , Alpine ,
126
+ Debian , RPMDistro , Fedora , Redhat , CentOs , Oracle ,
127
+ AlmaLinux , Suse , SLES , NixOS , OtherLinux ))
128
+ or (isinstance (self .node .os , Ubuntu ) and self .node .os .information .version < "18.4.0" )
121
129
):
122
- raise UnsupportedDistroException (
130
+ raise UnsupportedDistroException (
123
131
self .node .os , "kselftests in LISA does not support this os"
124
132
)
125
133
@@ -202,14 +210,12 @@ def run_all(
202
210
test_result : TestResult ,
203
211
log_path : str ,
204
212
timeout : int = 5000 ,
205
- run_test_as_root : bool = False ,
206
213
) -> List [KselftestResult ]:
207
214
# Executing kselftest as root may cause
208
215
# VM to hang
209
216
210
- # get username
211
- username = self .node .tools [Whoami ].get_username ()
212
- result_directory = f"/home/{ username } "
217
+ # get result directory
218
+ result_directory = f"/tmp/"
213
219
if os .path .exists (result_directory ) is False :
214
220
mkdir = self .node .tools [Mkdir ]
215
221
mkdir .create_directory (result_directory )
@@ -218,7 +224,7 @@ def run_all(
218
224
result_file = f"{ result_directory } /{ result_file_name } "
219
225
self .run (
220
226
f" 2>&1 | tee { result_file } " ,
221
- sudo = run_test_as_root ,
227
+ sudo = True ,
222
228
force_run = True ,
223
229
shell = True ,
224
230
timeout = timeout ,
0 commit comments