-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/thread_float: improve output and add test script
- Give the three threads the names "t1", "t2", and "t3" and print them on console, instead of the process ID. This makes interpretation of the output easier, as the process IDs depend e.g. on whether a given platforms requires an idle thread or not. - Do not use the thread ID in the calculation, but the number at the end of the thread name. This will result in the number printed only depending on the precision of the (software) FPU and the printf() implementation, and not on which threads are created in which order (including the idle thread) - Add a script to support running `make test`
- Loading branch information
Showing
2 changed files
with
56 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (C) 2021 Otto-von-Guericke-Universität Magdeburg | ||
# | ||
# This file is subject to the terms and conditions of the GNU Lesser | ||
# General Public License v2.1. See the file LICENSE in the top level | ||
# directory for more details. | ||
|
||
# @author Marian Buschsieweke <marian.buschsieweke@ovgu.de> | ||
|
||
import sys | ||
from testrunner import run | ||
|
||
|
||
def testfunc(child): | ||
child.expect("THREADS CREATED") | ||
child.expect("") | ||
child.expect("THREAD t1 start") | ||
child.expect("THREAD t2 start") | ||
child.expect("THREAD t3 start") | ||
for _ in range(10): | ||
child.expect(r"t(\d): (\d\d\d).\d+") | ||
first_thread = int(child.match.group(1)) | ||
assert 141 == int(child.match.group(2)) | ||
assert (first_thread == 1) or (first_thread == 3) | ||
child.expect(r"t(\d): (\d\d\d).\d+") | ||
second_thread = int(child.match.group(1)) | ||
assert 141 == int(child.match.group(2)) | ||
assert (second_thread == 1) or (second_thread == 3) | ||
assert first_thread != second_thread | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(run(testfunc)) |