forked from rcore-os/zCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rcore-os#215 from chyyuu/master
Add libos-mode core-test CI
- Loading branch information
Showing
15 changed files
with
1,693 additions
and
16 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
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,77 @@ | ||
import pexpect | ||
import sys | ||
import re | ||
import os | ||
|
||
TIMEOUT = 20 | ||
ZCORE_PATH = '../zCore' | ||
BASE = 'zircon/' | ||
OUTPUT_FILE = BASE + 'test-output-baremetal.txt' | ||
RESULT_FILE = BASE + 'test-result-baremetal.txt' | ||
CHECK_FILE = BASE + 'test-check-passed.txt' | ||
DBG_FILE = BASE + 'dbg-b.txt' | ||
TEST_CASE_FILE = BASE + 'testcases-all.txt' | ||
|
||
|
||
class Tee: | ||
def __init__(self, name, mode): | ||
self.file = open(name, mode) | ||
self.stdout = sys.stdout | ||
sys.stdout = self | ||
|
||
def __del__(self): | ||
sys.stdout = self.stdout | ||
self.file.close() | ||
|
||
def write(self, data): | ||
self.file.write(data) | ||
self.stdout.write(data) | ||
|
||
def flush(self): | ||
self.file.flush() | ||
|
||
if os.path.exists(OUTPUT_FILE): os.remove(OUTPUT_FILE) | ||
if os.path.exists(RESULT_FILE): os.remove(RESULT_FILE) | ||
if os.path.exists(DBG_FILE): os.remove(DBG_FILE) | ||
|
||
with open(TEST_CASE_FILE, "r") as tcf: | ||
lines = tcf.readlines() | ||
for line in lines: | ||
with open(DBG_FILE, "a") as dbg: print(line, file=dbg) | ||
|
||
child = pexpect.spawn("make -C %s test mode=release test_filter='%s'" % (ZCORE_PATH, line.replace('\n','')), | ||
timeout=TIMEOUT, encoding='utf-8') | ||
child.logfile = Tee(OUTPUT_FILE, 'a') | ||
|
||
index = child.expect(['finished!', 'panicked', pexpect.EOF, pexpect.TIMEOUT]) | ||
result = ['FINISHED', 'PANICKED', 'EOF', 'TIMEOUT'][index] | ||
print(result) | ||
|
||
passed = [] | ||
failed = [] | ||
passed_case = set() | ||
|
||
# see https://stackoverflow.com/questions/59379174/ignore-ansi-colors-in-pexpect-response | ||
ansi_escape = re.compile(r"\x1B[@-_][0-?]*[ -/]*[@-~]") | ||
|
||
with open(OUTPUT_FILE, "r") as opf: | ||
for line in opf: | ||
line=ansi_escape.sub('',line) | ||
with open(RESULT_FILE, "a") as rstf: | ||
if line.startswith('[ OK ]'): | ||
print(line, file=rstf) | ||
elif line.startswith('[ FAILED ]') and line.endswith(')\n'): | ||
print(line, file=rstf) | ||
|
||
|
||
# with open(CHECK_FILE, 'r') as f: | ||
# check_case = set([case.strip() for case in f.readlines()]) | ||
|
||
# not_passed = check_case - passed_case | ||
# if not_passed: | ||
# print('=== Failed cases ===') | ||
# for case in not_passed: | ||
# print(case) | ||
# exit(1) | ||
# else: | ||
# print('All checked case passed!') |
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,23 @@ | ||
import pexpect | ||
import sys | ||
import re | ||
import argparse | ||
|
||
TIMEOUT = 300 | ||
ZIRCON_LOADER_PATH = 'zircon-loader' | ||
PREBUILT_PATH = '../prebuilt/zircon/x64' | ||
CMDLINE_BASE = 'LOG=warn:userboot=test/core-standalone-test:userboot.shutdown:core-tests=' | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('testcase', nargs=1) | ||
args = parser.parse_args() | ||
|
||
child = pexpect.spawn("cargo run -p '%s' -- '%s' '%s' --debug " % | ||
(ZIRCON_LOADER_PATH, PREBUILT_PATH, CMDLINE_BASE+args.testcase[0]), | ||
timeout=TIMEOUT, encoding='utf-8') | ||
|
||
child.logfile = sys.stdout | ||
|
||
index = child.expect(['finished!', 'panicked', pexpect.EOF, pexpect.TIMEOUT]) | ||
result = ['FINISHED', 'PANICKED', 'EOF', 'TIMEOUT'][index] | ||
print(result) |
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,83 @@ | ||
import pexpect | ||
import sys | ||
import re | ||
import os | ||
|
||
TIMEOUT = 300 | ||
ZIRCON_LOADER_PATH = 'zircon-loader' | ||
BASE = 'zircon/' | ||
OUTPUT_FILE = BASE + 'test-output-libos.txt' | ||
RESULT_FILE = BASE + 'test-result-libos.txt' | ||
CHECK_FILE = BASE + 'test-check-passed.txt' | ||
TEST_CASE_ALL = BASE + 'testcases-all.txt' | ||
TEST_CASE_EXCEPTION = BASE + 'testcases-failed-libos.txt' | ||
PREBUILT_PATH = '../prebuilt/zircon/x64' | ||
CMDLINE_BASE = 'LOG=warn:userboot=test/core-standalone-test:userboot.shutdown:core-tests=' | ||
|
||
class Tee: | ||
def __init__(self, name, mode): | ||
self.file = open(name, mode) | ||
self.stdout = sys.stdout | ||
sys.stdout = self | ||
|
||
def __del__(self): | ||
sys.stdout = self.stdout | ||
self.file.close() | ||
|
||
def write(self, data): | ||
self.file.write(data) | ||
self.stdout.write(data) | ||
|
||
def flush(self): | ||
self.file.flush() | ||
|
||
if os.path.exists(OUTPUT_FILE): os.remove(OUTPUT_FILE) | ||
if os.path.exists(RESULT_FILE): os.remove(RESULT_FILE) | ||
|
||
with open(TEST_CASE_ALL, "r") as tcf: | ||
all_case = set([case.strip() for case in tcf.readlines()]) | ||
with open(TEST_CASE_EXCEPTION, "r") as tcf: | ||
exception_case = set([case.strip() for case in tcf.readlines()]) | ||
check_case = all_case - exception_case | ||
|
||
for line in check_case: | ||
child = pexpect.spawn("cargo run -p '%s' -- '%s' '%s' --debug" % | ||
(ZIRCON_LOADER_PATH, PREBUILT_PATH, CMDLINE_BASE+line), | ||
timeout=TIMEOUT, encoding='utf-8') | ||
|
||
child.logfile = Tee(OUTPUT_FILE, 'a') | ||
|
||
index = child.expect(['finished!', 'panicked', pexpect.EOF, pexpect.TIMEOUT]) | ||
result = ['FINISHED', 'PANICKED', 'EOF', 'TIMEOUT'][index] | ||
# print(result) | ||
|
||
passed = [] | ||
failed = [] | ||
passed_case = set() | ||
|
||
# see https://stackoverflow.com/questions/59379174/ignore-ansi-colors-in-pexpect-response | ||
ansi_escape = re.compile(r"\x1B[@-_][0-?]*[ -/]*[@-~]") | ||
|
||
|
||
with open(OUTPUT_FILE, "r") as opf: | ||
for line in opf.readlines(): | ||
line=ansi_escape.sub('',line) | ||
if line.startswith('[ OK ]'): | ||
passed += line | ||
passed_case.add(line[13:].split(' ')[0]) | ||
elif line.startswith('[ FAILED ]') and line.endswith(')\n'): | ||
failed += line | ||
|
||
with open(RESULT_FILE, "a") as rstf: | ||
rstf.writelines(passed) | ||
rstf.writelines(failed) | ||
|
||
|
||
not_passed = check_case - passed_case | ||
if not_passed: | ||
print('=== Failed cases ===') | ||
for case in not_passed: | ||
print(case) | ||
exit(1) | ||
else: | ||
print('All checked case passed!') |
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,6 @@ | ||
[0m[0m[1m[32m Finished[0m dev [unoptimized + debuginfo] target(s) in 0.04s | ||
[0m[0m[1m[32m Running[0m `/home/deathwish/Append/code/ZCORE/zCore/target/debug/zircon-loader ../prebuilt/zircon/x64 'LOG=warn:userboot=test/core-standalone-test:userboot.shutdown:core-tests=*,-Bti.NoDelayedUnpin,Bti.DecommitRace,ProcessDebugVDSO.*,HandleCloseTest.ManyDuplicateTest*,JobTest.*,JobGetInfoTest.InfoJobProcessesPartiallyUnmappedBufferIsInvalidArgs,JobGetInfoTest.InfoJobChildrenPartiallyUnmappedBufferIsInvalidArgs,PortTest.AsyncWaitInvalidOption,PortTest.Timestamp,PortStressTest.WaitSignalCancel,PortStressTest.SignalCloseWait,ProcessTest.ProcessWaitAsyncCancelSelf,Pthread.*,PThreadBarrierTest.SingleThreadWinsBarrierObjectResetsBetweenIterations,SyncMutex.NoRecursion,Threads.Reading*State,Threads.DebugRegistersValidation,Threads.NoncanonicalRipAddressIRETQ,Threads.StartSuspendedThread,Threads.X86AcFlagUserCopy,Vmar.ProtectOverDemandPagedTest,Vmar.ProtectLargeUncomittedTest,Vmar.UnmapLargeUncommittedTest,Vmar.NestedRegionPermsTest,Vmar.MapSpecificOverwriteTest,Vmar.MapOverDestroyedTest,MemoryMappingTest.MprotectTest,MemoryMappingTest.MmapProtExecTest,MemoryMappingTest.MmapProtTest,VmoTestCase.ReadOnlyMap,VmoTestCase.MapRead,VmoTestCase.ParallelRead,VmoTestCase.NoPermMap,VmoTestCase.NoPermProtect,VmoTestCase.Commit,VmoTestCase.CacheOp,VmoTestCase.ResizeHazard,VmoTestCase.Cache*,VmoTestCase.ZeroPage,VmoTestCase.PinTests,VmoCloneTestCase.Commit,VmoClone2TestCase.PinClonePages,SocketTest.ReadIntoBadBuffer,SocketTest.WriteFromBadBuffer,VersionTest.*,BadAccessTest.*,InterruptTest.BindTriggeredIrqToPort,InterruptTest.WaitThreadFunctionsAfterSuspendResume,*Profile*,SystemEvent.*,Resource.*' --debug` | ||
userboot: option "LOG=warn" | ||
userboot: option "userboot=test/core-standalone-test" | ||
userboot: option "userboot.shutdown" | ||
userboot: option "core-tests=*,-Bti.NoDelayedUnpin,Bti.DecommitRace,ProcessDebugVDSO.*,HandleCloseTest.ManyDuplicateTest*,JobTest.*,JobGetInfoTest.InfoJobProcessesPartiallyUnmappedBufferIsInvalidArgs,JobGetInfoTest.InfoJobCh |
Empty file.
Oops, something went wrong.