2023-02-19 04:33:21 +01:00
|
|
|
#!/usr/bin/env python3
|
2022-09-16 08:46:58 +02:00
|
|
|
# encoding: utf-8
|
2024-03-21 11:49:16 +01:00
|
|
|
import os
|
|
|
|
|
2022-09-16 08:46:58 +02:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
pytestmark = [pytest.mark.common, pytest.mark.qemu]
|
|
|
|
do_not_support = ["sabre-6quad", "rv-virt", "rv-virt64", "esp32c3-devkit", "bl602evb"]
|
|
|
|
|
|
|
|
|
|
|
|
def test_ostest(p):
|
2024-03-21 11:49:16 +01:00
|
|
|
if p.board == "sim":
|
|
|
|
os.mkdir("./test")
|
|
|
|
ret = p.sendCommand("mount -t hostfs -o fs=./test /data")
|
|
|
|
|
2024-02-20 03:54:27 +01:00
|
|
|
ret = p.sendCommand("ostest", "Exiting with status 0", timeout=300)
|
2022-09-16 08:46:58 +02:00
|
|
|
assert ret == 0
|
|
|
|
|
|
|
|
|
|
|
|
def test_mm(p):
|
|
|
|
if p.board in do_not_support:
|
|
|
|
pytest.skip("unsupported at {}".format(p.board))
|
2024-02-20 03:54:27 +01:00
|
|
|
ret = p.sendCommand("mm", "TEST COMPLETE", timeout=120)
|
2022-09-16 08:46:58 +02:00
|
|
|
assert ret == 0
|
|
|
|
|
|
|
|
|
|
|
|
def test_cxxtest(p):
|
|
|
|
if p.board in do_not_support:
|
|
|
|
pytest.skip("unsupported at {}".format(p.board))
|
|
|
|
ret = p.sendCommand("cxxtest", "Test std::map")
|
|
|
|
assert ret == 0
|
|
|
|
|
|
|
|
|
|
|
|
def test_scanftest(p):
|
|
|
|
if p.board in do_not_support:
|
|
|
|
pytest.skip("unsupported at {}".format(p.board))
|
2024-01-10 07:00:44 +01:00
|
|
|
ret = p.sendCommand("scanftest", "FAILED: 0")
|
2022-09-16 08:46:58 +02:00
|
|
|
assert ret == 0
|
|
|
|
|
|
|
|
|
|
|
|
def test_getprime(p):
|
|
|
|
if p.board in ["rv-virt", "rv-virt64"]:
|
|
|
|
pytest.skip("unsupported at {}".format(p.board))
|
|
|
|
ret = p.sendCommand("getprime", "getprime took")
|
|
|
|
assert ret == 0
|
|
|
|
|
|
|
|
|
2023-10-24 11:50:10 +02:00
|
|
|
def test_stdio(p):
|
2023-10-17 09:33:10 +02:00
|
|
|
if p.board in do_not_support:
|
|
|
|
pytest.skip("unsupported at {}".format(p.board))
|
|
|
|
ret = p.sendCommand("fopencookie_test", "fopencokie tests were succesfull.")
|
|
|
|
assert ret == 0
|
2023-10-24 11:50:10 +02:00
|
|
|
ret = p.sendCommand("fmemopen_test", "FAILED: 0")
|
|
|
|
assert ret == 0
|
2023-11-26 22:58:57 +01:00
|
|
|
ret = p.sendCommand("open_memstream_test", "FAILED: 0")
|
|
|
|
assert ret == 0
|
2023-10-17 09:33:10 +02:00
|
|
|
|
|
|
|
|
2022-10-29 09:02:55 +02:00
|
|
|
@pytest.mark.run(order=-2)
|
2022-09-16 08:46:58 +02:00
|
|
|
def test_fs_test(p):
|
|
|
|
if p.board in do_not_support:
|
|
|
|
pytest.skip("unsupported at {}".format(p.board))
|
|
|
|
fstest_dir = "{}/{}_fstest".format(p.fs, p.core)
|
|
|
|
p.sendCommand("mkdir %s" % fstest_dir)
|
2024-02-20 03:54:27 +01:00
|
|
|
ret = p.sendCommand("fstest -n 10 -m %s" % fstest_dir, "FAILED: 0", timeout=2000)
|
2022-09-16 08:46:58 +02:00
|
|
|
p.sendCommand("ls %s" % fstest_dir)
|
|
|
|
p.sendCommand("rmdir %s" % fstest_dir)
|
2024-03-21 11:49:16 +01:00
|
|
|
|
|
|
|
if p.board == "sim":
|
|
|
|
os.rmdir("./test")
|
2022-09-16 08:46:58 +02:00
|
|
|
assert ret == 0
|
|
|
|
|
|
|
|
|
2022-10-29 09:02:55 +02:00
|
|
|
@pytest.mark.run(order=-1)
|
2022-09-16 08:46:58 +02:00
|
|
|
def test_psram_test(p):
|
|
|
|
if p.board in do_not_support:
|
|
|
|
pytest.skip("unsupported at {}".format(p.board))
|
|
|
|
if p.sendCommand("ls /", "tmp/") == 0:
|
2024-02-20 03:54:27 +01:00
|
|
|
ret = p.sendCommand("fstest -n 10 -m /tmp", "Final memory usage", timeout=500)
|
2022-09-16 08:46:58 +02:00
|
|
|
p.sendCommand("ls /tmp")
|
|
|
|
assert ret == 0
|