-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add posix tests (waiting for lsb_vsx port merge) #126
Open
adamdebek
wants to merge
1
commit into
master
Choose a base branch
from
adamdebek/lsb_vsx_tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+623
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
NAME := run-test | ||
LOCAL_SRCS := run-test.c | ||
|
||
include $(binary.mk) |
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,52 @@ | ||||||
from typing import Optional | ||||||
|
||||||
from trunner.ctx import TestContext | ||||||
from trunner.dut import Dut | ||||||
from trunner.types import Status, TestResult | ||||||
|
||||||
|
||||||
def harness(dut: Dut, ctx: TestContext, result: TestResult) -> Optional[TestResult]: | ||||||
tc_start = r".+?\|TP Start\r+\n" | ||||||
msg_re = r".+\|(?P<msg_line>.*?)\r+\n" | ||||||
result_re = r"(.+?)\|(?P<status>PASS|FAIL|UNRESOLVED|UNSUPPORTED|NOTINUSE|UNTESTED)\r+\n" | ||||||
final_re = r"(.+?)\|TC End.+?\r+\n" | ||||||
|
||||||
stats = {"FAIL": 0, "IGNORE": 0, "PASS": 0} | ||||||
msg = "" | ||||||
msg_lines = [] | ||||||
results = [] | ||||||
tc_num = 0 | ||||||
get_msg = False | ||||||
|
||||||
dut.expect("Config End\r+\n") | ||||||
|
||||||
while True: | ||||||
idx = dut.expect([tc_start, final_re, result_re, msg_re], timeout=1000) | ||||||
parsed = dut.match.groupdict() | ||||||
|
||||||
if idx == 0: | ||||||
get_msg = True | ||||||
elif idx == 1: | ||||||
break | ||||||
elif idx == 2: | ||||||
# Right now, not supported statuses treat as PASS | ||||||
if parsed["status"] in ("UNRESOLVED", "UNSUPPORTED", "NOTINUSE", "UNTESTED"): | ||||||
parsed["status"] = "PASS" | ||||||
|
||||||
status = Status.from_str(parsed["status"]) | ||||||
tc_num += 1 | ||||||
subname = f"testcase {tc_num}" | ||||||
if msg_lines: | ||||||
msg += msg_lines[0] | ||||||
for line in msg_lines[1:]: | ||||||
msg += "\n" + " " * 26 + line.lstrip() | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should work, but it’s up to you
Suggested change
|
||||||
result.add_subresult(subname, status, msg) | ||||||
|
||||||
stats[parsed["status"]] += 1 | ||||||
results.append(parsed) | ||||||
get_msg, msg_lines, msg = False, [], "" | ||||||
elif idx == 3 and get_msg is True: | ||||||
msg_lines.append(parsed["msg_line"]) | ||||||
|
||||||
status = Status.FAIL if stats["FAIL"] != 0 else Status.OK | ||||||
return TestResult(status=status) |
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,68 @@ | ||
/* | ||
* Phoenix-RTOS | ||
* | ||
* lsb_vsx test launcher | ||
* | ||
* Copyright 2024 Phoenix Systems | ||
* Author: Adam Debek | ||
* | ||
* This file is part of Phoenix-RTOS. | ||
* | ||
* %LICENSE% | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
#include <stdlib.h> | ||
|
||
|
||
int main(int argc, char **argv) | ||
{ | ||
const char *cmd = "/usr/bin/tcc -j - -e -l "; | ||
char test_cmd[128]; | ||
int ret; | ||
|
||
if (argc != 2) { | ||
fprintf(stderr, "No path to test executable provided\n"); | ||
exit(EXIT_FAILURE); | ||
} | ||
else { | ||
strcpy(test_cmd, cmd); | ||
strcat(test_cmd, argv[1]); | ||
} | ||
|
||
if (chdir("/root/lsb_vsx/test_sets") < 0) { | ||
perror("chdir"); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
if (setenv("TET_ROOT", "/root/lsb_vsx", 0) < 0) { | ||
fprintf(stderr, "setenv() - setting \"TET_ROOT\" failed\n"); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
if (setenv("TET_EXECUTE", "/root/lsb_vsx/test_sets/TESTROOT", 0) < 0) { | ||
fprintf(stderr, "setenv() - setting \"TET_EXECUTE\" failed\n"); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
if ((ret = system(test_cmd)) < 0) { | ||
perror("system"); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
if (WIFEXITED(ret)) { | ||
int exit_status = WEXITSTATUS(ret); | ||
if (exit_status != 0) { | ||
fprintf(stderr, "Error: Command exited with status %d\n", exit_status); | ||
exit(EXIT_FAILURE); | ||
} | ||
} | ||
else { | ||
fprintf(stderr, "Error: Command did not exit normally\n"); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
return EXIT_SUCCESS; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be more like SKIP? By the way, we have catching UNTESTED .