Skip to contentSkip to conversation

kunit: Fix '--build_dir' option

PATCH In review SeongJae Park 3 participants 9 messages Sep 6, 2019 – Oct 7, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kunit: Fix '--build_dir' option

kunit fails to run with '--build_dir' option because the option is not properly sent to kernel running procedure. This commit fixes the problem.

---
 tools/testing/kunit/kunit.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/testing/kunit/kunit.py +4 -2
index 8d33980..e016430 100755
@@ -62,9 +62,11 @@ def run_tests(linux: kunit_kernel.LinuxSourceTree,
 					      'Tests not Parsed.')
 	if request.raw_output:
 		kunit_parser.raw_output(
-			linux.run_kernel(timeout=request.timeout))
+			linux.run_kernel(timeout=request.timeout,
+					 build_dir=request.build_dir))
 	else:
-		kunit_output = linux.run_kernel(timeout=request.timeout)
+		kunit_output = linux.run_kernel(timeout=request.timeout,
+						build_dir=request.build_dir)
 		test_result = kunit_parser.parse_run_tests(kunit_output)
 	test_end = time.time()
 
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 3 lines · SeongJae Park

kunit fails to run with '--build_dir' option because the option is not properly sent to kernel running procedure. This commit fixes the problem.

Can you please include the failure you are seeing in the commit log

thanks,
-- Shuah

#2 lore raw
Quoted 7 lines · shuah
Quoted 3 lines · SeongJae Park

kunit fails to run with '--build_dir' option because the option is not properly sent to kernel running procedure. This commit fixes the problem.

Can you please include the failure you are seeing in the commit log

Yes, I will.

Thanks,
SeongJae Park

Quoted 5 lines

thanks,
-- Shuah

#3 lore raw

PATCH 1/1 kunit: Fix '--build_dir' option

Running kunit with '--build_dir' option gives following error message:

```
$ ./tools/testing/kunit/kunit.py run --build_dir ../linux.out.kunit/
[00:57:24] Building KUnit Kernel ...
[00:57:29] Starting KUnit Kernel ...
Traceback (most recent call last):
  File "./tools/testing/kunit/kunit.py", line 136, in <module>
    main(sys.argv[1:])
  File "./tools/testing/kunit/kunit.py", line 129, in main
    result = run_tests(linux, request)
  File "./tools/testing/kunit/kunit.py", line 68, in run_tests
    test_result = kunit_parser.parse_run_tests(kunit_output)
  File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
283, in parse_run_tests
    test_result =
parse_test_result(list(isolate_kunit_output(kernel_output)))
  File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
54, in isolate_kunit_output
    for line in kernel_output:
  File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
145, in run_kernel
    process = self._ops.linux_bin(args, timeout, build_dir)
  File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
69, in linux_bin
    stderr=subprocess.PIPE)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: './linux'
```

This error occurs because the '--build_dir' option value is not passed to the 'run_kernel()' function. Consequently, the function assumes the kernel image that built for the tests, which is under the '--build_dir' directory, is in kernel source directory and finally raises the 'FileNotFoundError'.

This commit fixes the problem by properly passing the '--build_dir' option value to the 'run_kernel()'.

---
 tools/testing/kunit/kunit.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/testing/kunit/kunit.py +4 -2
index 8d33980..e016430 100755
@@ -62,9 +62,11 @@ def run_tests(linux: kunit_kernel.LinuxSourceTree,
 					      'Tests not Parsed.')
 	if request.raw_output:
 		kunit_parser.raw_output(
-			linux.run_kernel(timeout=request.timeout))
+			linux.run_kernel(timeout=request.timeout,
+					 build_dir=request.build_dir))
 	else:
-		kunit_output = linux.run_kernel(timeout=request.timeout)
+		kunit_output = linux.run_kernel(timeout=request.timeout,
+						build_dir=request.build_dir)
 		test_result = kunit_parser.parse_run_tests(kunit_output)
 	test_end = time.time()
 
Signature · 1 line
2.7.4
Reviewed-by Tested-by on v1 1/1
#4 lore raw
Quoted 40 lines · SeongJae Park

Running kunit with '--build_dir' option gives following error message:

```
$ ./tools/testing/kunit/kunit.py run --build_dir ../linux.out.kunit/
[00:57:24] Building KUnit Kernel ...
[00:57:29] Starting KUnit Kernel ...
Traceback (most recent call last):
  File "./tools/testing/kunit/kunit.py", line 136, in <module>
    main(sys.argv[1:])
  File "./tools/testing/kunit/kunit.py", line 129, in main
    result = run_tests(linux, request)
  File "./tools/testing/kunit/kunit.py", line 68, in run_tests
    test_result = kunit_parser.parse_run_tests(kunit_output)
  File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
283, in parse_run_tests
    test_result =
parse_test_result(list(isolate_kunit_output(kernel_output)))
  File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
54, in isolate_kunit_output
    for line in kernel_output:
  File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
145, in run_kernel
    process = self._ops.linux_bin(args, timeout, build_dir)
  File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
69, in linux_bin
    stderr=subprocess.PIPE)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: './linux'
```

This error occurs because the '--build_dir' option value is not passed to the 'run_kernel()' function. Consequently, the function assumes the kernel image that built for the tests, which is under the '--build_dir' directory, is in kernel source directory and finally raises the 'FileNotFoundError'.

Quoted 4 lines

This commit fixes the problem by properly passing the '--build_dir' option value to the 'run_kernel()'.

Thanks!

maintainer
#5 lore raw
Quoted 44 lines · Brendan Higgins
Quoted 43 lines · SeongJae Park

Running kunit with '--build_dir' option gives following error message:

```
$ ./tools/testing/kunit/kunit.py run --build_dir ../linux.out.kunit/
[00:57:24] Building KUnit Kernel ...
[00:57:29] Starting KUnit Kernel ...
Traceback (most recent call last):
   File "./tools/testing/kunit/kunit.py", line 136, in <module>
     main(sys.argv[1:])
   File "./tools/testing/kunit/kunit.py", line 129, in main
     result = run_tests(linux, request)
   File "./tools/testing/kunit/kunit.py", line 68, in run_tests
     test_result = kunit_parser.parse_run_tests(kunit_output)
   File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
283, in parse_run_tests
     test_result =
parse_test_result(list(isolate_kunit_output(kernel_output)))
   File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
54, in isolate_kunit_output
     for line in kernel_output:
   File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
145, in run_kernel
     process = self._ops.linux_bin(args, timeout, build_dir)
   File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
69, in linux_bin
     stderr=subprocess.PIPE)
   File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
     restore_signals, start_new_session)
   File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
     raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: './linux'
```

This error occurs because the '--build_dir' option value is not passed to the 'run_kernel()' function. Consequently, the function assumes the kernel image that built for the tests, which is under the '--build_dir' directory, is in kernel source directory and finally raises the 'FileNotFoundError'.

This commit fixes the problem by properly passing the '--build_dir' option value to the 'run_kernel()'.

Quoted 7 lines
Quoted 1 line

Thanks!

Thanks Brendan! I will apply the patch for 5.4-rc1.

SeongJae Park! In the future, please send tag versions. This should have been [PATCH v2].

thanks,
-- Shuah

#6 lore raw
Quoted 48 lines · shuah
Quoted 46 lines · Brendan Higgins
Quoted 44 lines · SeongJae Park

Running kunit with '--build_dir' option gives following error message:

```
$ ./tools/testing/kunit/kunit.py run --build_dir ../linux.out.kunit/
[00:57:24] Building KUnit Kernel ...
[00:57:29] Starting KUnit Kernel ...
Traceback (most recent call last):
   File "./tools/testing/kunit/kunit.py", line 136, in <module>
     main(sys.argv[1:])
   File "./tools/testing/kunit/kunit.py", line 129, in main
     result = run_tests(linux, request)
   File "./tools/testing/kunit/kunit.py", line 68, in run_tests
     test_result = kunit_parser.parse_run_tests(kunit_output)
   File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
283, in parse_run_tests
     test_result =
parse_test_result(list(isolate_kunit_output(kernel_output)))
   File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
54, in isolate_kunit_output
     for line in kernel_output:
   File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
145, in run_kernel
     process = self._ops.linux_bin(args, timeout, build_dir)
   File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
69, in linux_bin
     stderr=subprocess.PIPE)
   File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
     restore_signals, start_new_session)
   File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
     raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: './linux'
```

This error occurs because the '--build_dir' option value is not passed to the 'run_kernel()' function. Consequently, the function assumes the kernel image that built for the tests, which is under the '--build_dir' directory, is in kernel source directory and finally raises the 'FileNotFoundError'.

This commit fixes the problem by properly passing the '--build_dir' option value to the 'run_kernel()'.

Quoted 7 lines
Quoted 5 lines

Thanks!

Thanks Brendan! I will apply the patch for 5.4-rc1.

Thank you both!

Quoted 3 lines

SeongJae Park! In the future, please send tag versions. This should have been [PATCH v2].

Yes, I will.

Thanks,
SeongJae Park

Quoted 3 lines

thanks,
-- Shuah

#7 lore raw
In reply to shuah
Quoted 48 lines · shuah
Quoted 46 lines · Brendan Higgins
Quoted 44 lines · SeongJae Park

Running kunit with '--build_dir' option gives following error message:

```
$ ./tools/testing/kunit/kunit.py run --build_dir ../linux.out.kunit/
[00:57:24] Building KUnit Kernel ...
[00:57:29] Starting KUnit Kernel ...
Traceback (most recent call last):
   File "./tools/testing/kunit/kunit.py", line 136, in <module>
     main(sys.argv[1:])
   File "./tools/testing/kunit/kunit.py", line 129, in main
     result = run_tests(linux, request)
   File "./tools/testing/kunit/kunit.py", line 68, in run_tests
     test_result = kunit_parser.parse_run_tests(kunit_output)
   File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
283, in parse_run_tests
     test_result =
parse_test_result(list(isolate_kunit_output(kernel_output)))
   File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
54, in isolate_kunit_output
     for line in kernel_output:
   File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
145, in run_kernel
     process = self._ops.linux_bin(args, timeout, build_dir)
   File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
69, in linux_bin
     stderr=subprocess.PIPE)
   File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
     restore_signals, start_new_session)
   File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
     raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: './linux'
```

This error occurs because the '--build_dir' option value is not passed to the 'run_kernel()' function. Consequently, the function assumes the kernel image that built for the tests, which is under the '--build_dir' directory, is in kernel source directory and finally raises the 'FileNotFoundError'.

This commit fixes the problem by properly passing the '--build_dir' option value to the 'run_kernel()'.

Quoted 7 lines
Quoted 5 lines

Thanks!

Thanks Brendan! I will apply the patch for 5.4-rc1.

Shuah, can you apply this to the kselftest KUnit branch? This should not require a resend.

maintainer
#8 lore raw
Quoted 52 lines · Brendan Higgins
Quoted 51 lines · shuah
Quoted 49 lines · Brendan Higgins
Quoted 40 lines · SeongJae Park

Running kunit with '--build_dir' option gives following error message:

```
$ ./tools/testing/kunit/kunit.py run --build_dir ../linux.out.kunit/
[00:57:24] Building KUnit Kernel ...
[00:57:29] Starting KUnit Kernel ...
Traceback (most recent call last):
    File "./tools/testing/kunit/kunit.py", line 136, in <module>
      main(sys.argv[1:])
    File "./tools/testing/kunit/kunit.py", line 129, in main
      result = run_tests(linux, request)
    File "./tools/testing/kunit/kunit.py", line 68, in run_tests
      test_result = kunit_parser.parse_run_tests(kunit_output)
    File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
283, in parse_run_tests
      test_result =
parse_test_result(list(isolate_kunit_output(kernel_output)))
    File "/home/sjpark/linux/tools/testing/kunit/kunit_parser.py", line
54, in isolate_kunit_output
      for line in kernel_output:
    File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
145, in run_kernel
      process = self._ops.linux_bin(args, timeout, build_dir)
    File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line
69, in linux_bin
      stderr=subprocess.PIPE)
    File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
      restore_signals, start_new_session)
    File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
      raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: './linux'
```

This error occurs because the '--build_dir' option value is not passed to the 'run_kernel()' function. Consequently, the function assumes the kernel image that built for the tests, which is under the '--build_dir' directory, is in kernel source directory and finally raises the 'FileNotFoundError'.

Quoted 4 lines

This commit fixes the problem by properly passing the '--build_dir' option value to the 'run_kernel()'.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Thanks!

Thanks Brendan! I will apply the patch for 5.4-rc1.

Shuah, can you apply this to the kselftest KUnit branch? This should not require a resend.

Done. Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git test

thanks,
-- Shuah