Update libc-tests.py

This commit is contained in:
Yuekai Jia 2021-09-05 16:45:27 +08:00
parent ceacbc9d9c
commit 1097f4ac1e
5 changed files with 76 additions and 62 deletions

View File

@ -1,6 +1,6 @@
name: current CI
on:
on:
push:
pull_request:
schedule:
@ -52,7 +52,7 @@ jobs:
- name: Build zCore
run: |
cd zCore
make build arch=x86_64
make build arch=x86_64
# FIX LATER
# - name: Build zCore with hypervisor
# run: |
@ -203,6 +203,7 @@ jobs:
- name: Run libc-tests
run: |
cd scripts
pip3 install -r requirements.txt
python3 libc-tests.py
cat linux/test-result.txt
@ -275,6 +276,8 @@ jobs:
tar xJf qemu-share.tar.xz && sudo cp -r qemu /usr/local/share/
- name: Prepare rootfs and oscomp
run: make riscv-image
- name: Build kernel
run: cd zCore && make build mode=release linux=1 arch=riscv64
- name: Run baremetal-libc-test
run: |
cd scripts

View File

@ -1,6 +1,6 @@
name: rustcnightly CI
on:
on:
push:
pull_request:
schedule:
@ -55,7 +55,7 @@ jobs:
- name: Build zCore
run: |
cd zCore
make build arch=x86_64
make build arch=x86_64
# FIX LATER
# - name: Build zCore with hypervisor
# run: |
@ -212,6 +212,7 @@ jobs:
- name: Run libc-tests
run: |
cd scripts
pip3 install -r requirements.txt
python3 libc-tests.py
cat linux/test-result.txt
@ -289,6 +290,8 @@ jobs:
tar xJf qemu-share.tar.xz && sudo cp -r qemu /usr/local/share/
- name: Prepare rootfs and oscomp
run: make riscv-image
- name: Build kernel
run: cd zCore && make build mode=release linux=1 arch=riscv64
- name: Run baremetal-libc-test
run: |
cd scripts

View File

@ -1,15 +1,17 @@
import os
import time
import glob
import subprocess
from termcolor import colored
# ===============Must Config========================
TIMEOUT = 5 # seconds
TIMEOUT = 10 # seconds
ZCORE_PATH = '../zCore'
BASE = 'linux/'
OUTPUT_FILE = BASE + 'test-output.txt'
RESULT_FILE = BASE + 'test-result.txt'
CHECK_FILE = BASE + 'test-allow-failed.txt'
CHECK_FILE = BASE + 'libos-test-allow-failed.txt'
# ==============================================
@ -17,41 +19,58 @@ passed = set()
failed = set()
timeout = set()
for path in glob.glob("../rootfs/libc-test/src/*/*.exe"):
def print_cases(cases, file=None):
for case in sorted(cases):
print(case, file=file)
subprocess.run("cd .. && cargo build --release -p linux-loader",
shell=True, check=True)
for path in sorted(glob.glob("../rootfs/libc-test/src/*/*.exe")):
path = path[len('../rootfs'):]
# ignore static linked tests
if path.endswith('-static.exe'):
continue
try:
subprocess.run("cd .. && cargo run --release -p linux-loader -- " + path,
time_start = time.time()
subprocess.run("cd .. && ./target/release/linux-loader " + path,
shell=True, timeout=TIMEOUT, check=True)
time_end = time.time()
passed.add(path)
print(colored('PASSED in %.3fs: %s' % (time_end - time_start, path), 'green'))
except subprocess.CalledProcessError:
failed.add(path)
print(colored('FAILED: %s' % path, 'red'))
except subprocess.TimeoutExpired:
timeout.add(path)
print(colored('TIMEOUT: %s' % path, 'yellow'))
with open(RESULT_FILE, "w") as f:
print('PASSED:', file=f)
for case in passed:
print(case, file=f)
print_cases(passed, file=f)
print('FAILED:', file=f)
for case in failed:
print(case, file=f)
print_cases(failed, file=f)
print('TIMEOUT:', file=f)
for case in timeout:
print(case, file=f)
print_cases(timeout, file=f)
with open(CHECK_FILE, 'r') as f:
allow_failed = set([case.strip() for case in f.readlines()])
more_passed = passed & allow_failed
if more_passed:
print(colored('=== Passed more cases ===', 'green'))
print_cases(more_passed)
check_failed = (failed | timeout) - allow_failed
if check_failed:
print('=== Failed cases ===')
for case in check_failed:
print(case)
print(colored('=== Failed cases ===', 'red'))
print_cases(failed - allow_failed)
print(colored('=== Timeout cases ===', 'yellow'))
print_cases(timeout - allow_failed)
exit(1)
else:
print('All checked case passed!')
print(colored('All checked case passed!', 'green'))
os.system('killall linux-loader')

View File

@ -1,51 +1,39 @@
/libc-test/src/common/runtest.exe
/libc-test/src/regression/getpwnam_r-errno.exe
/libc-test/src/regression/pthread_atfork-errno-clobber.exe
/libc-test/src/regression/sigreturn.exe
/libc-test/src/regression/pthread-robust-detach.exe
/libc-test/src/regression/fflush-exit.exe
/libc-test/src/regression/daemon-failure.exe
/libc-test/src/regression/rewind-clear-error.exe
/libc-test/src/regression/statvfs.exe
/libc-test/src/regression/pthread_exit-dtor.exe
/libc-test/src/regression/rlimit-open-files.exe
/libc-test/src/regression/getpwnam_r-crash.exe
/libc-test/src/functional/strptime.exe
/libc-test/src/functional/pthread_cancel-points.exe
/libc-test/src/functional/tls_align_dlopen.exe
/libc-test/src/functional/sem_open.exe
/libc-test/src/functional/tls_init_dlopen.exe
/libc-test/src/functional/ipc_shm.exe
/libc-test/src/functional/vfork.exe
/libc-test/src/functional/strtod_long.exe
/libc-test/src/functional/utime.exe
/libc-test/src/functional/setjmp.exe
/libc-test/src/functional/ipc_sem.exe
/libc-test/src/functional/fcntl.exe
/libc-test/src/functional/ipc_msg.exe
/libc-test/src/functional/socket.exe
/libc-test/src/functional/tls_align.exe
/libc-test/src/functional/ipc_sem.exe
/libc-test/src/functional/ipc_shm.exe
/libc-test/src/functional/popen.exe
/libc-test/src/functional/pthread_cancel-points.exe
/libc-test/src/functional/pthread_robust.exe
/libc-test/src/math/powf.exe
/libc-test/src/functional/sem_open.exe
/libc-test/src/functional/socket.exe
/libc-test/src/functional/spawn.exe
/libc-test/src/functional/strptime.exe
/libc-test/src/functional/strtod_long.exe
/libc-test/src/functional/tls_align.exe
/libc-test/src/functional/tls_align_dlopen.exe
/libc-test/src/functional/tls_init_dlopen.exe
/libc-test/src/functional/utime.exe
/libc-test/src/functional/vfork.exe
/libc-test/src/math/fmal.exe
/libc-test/src/math/modfl.exe
/libc-test/src/math/roundl.exe
/libc-test/src/regression/pthread_cond_wait-cancel_ignored.exe
/libc-test/src/regression/raise-race.exe
/libc-test/src/regression/pthread_once-deadlock.exe
/libc-test/src/regression/pthread_cond-smasher.exe
/libc-test/src/regression/pthread_condattr_setclock.exe
/libc-test/src/functional/pthread_mutex_pi.exe
/libc-test/src/math/powf.exe
/libc-test/src/regression/daemon-failure.exe
/libc-test/src/regression/execle-env.exe
/libc-test/src/regression/fflush-exit.exe
/libc-test/src/regression/getpwnam_r-crash.exe
/libc-test/src/regression/getpwnam_r-errno.exe
/libc-test/src/regression/pthread-robust-detach.exe
/libc-test/src/regression/pthread_atfork-errno-clobber.exe
/libc-test/src/regression/pthread_exit-dtor.exe
/libc-test/src/regression/sem_close-unmap.exe
/libc-test/src/regression/sigreturn.exe
/libc-test/src/regression/statvfs.exe
/libc-test/src/functional/pthread_cancel.exe
/libc-test/src/functional/pthread_mutex.exe
/libc-test/src/functional/spawn.exe
/libc-test/src/functional/popen.exe
/libc-test/src/regression/execle-env.exe
/libc-test/src/regression/malloc-oom.exe
/libc-test/src/regression/pthread_create-oom.exe
/libc-test/src/regression/setenv-oom.exe
/libc-test/src/regression/flockfile-list.exe
/libc-test/src/regression/malloc-brk-fail.exe
/libc-test/src/regression/iconv-roundtrips.exe
/libc-test/src/regression/sem_close-unmap.exe
/libc-test/src/regression/fgets-eof.exe
/libc-test/src/functional/pthread_mutex_pi.exe
/libc-test/src/regression/pthread_cond-smasher.exe
/libc-test/src/regression/pthread_cond_wait-cancel_ignored.exe
/libc-test/src/regression/pthread_condattr_setclock.exe
/libc-test/src/regression/pthread_once-deadlock.exe
/libc-test/src/regression/raise-race.exe

1
scripts/requirements.txt Normal file
View File

@ -0,0 +1 @@
termcolor