More work on the test suite

This commit is contained in:
Luke Benstead 2020-10-26 22:00:11 +00:00
parent b70a9df716
commit 53c0afce1e
5 changed files with 46 additions and 8 deletions

View File

@ -1,5 +1,6 @@
stages:
- build
- test
build:sh4-gcc:
stage: build
@ -8,3 +9,13 @@ build:sh4-gcc:
- source /etc/bash.bashrc
- make clean
- make samples
test:sh4-gcc:
stage: test
image: kazade/dreamcast-sdk
script:
- source /etc/bash.bashrc
- make test
- lxdream -H -b -e tests/tests.elf | python3 utils/test_parser.py

View File

@ -1,7 +1,6 @@
TARGET = tests.elf
OBJS = test_runner.o
TESTS = $(shell find . -name "*.cpp")
TESTS := $(shell find . -name \*.h)
CXXFLAGS := $(CXXFLAGS) -std=c++11
@ -10,12 +9,16 @@ all: rm-elf $(TARGET)
include $(KOS_BASE)/Makefile.rules
clean:
-rm -f $(TARGET) $(OBJS) romdisk.*
-rm -f $(TARGET) $(OBJS) romdisk.* test_runner.o test_runner.cpp
rm-elf:
-rm -f $(TARGET) romdisk.*
test_runner.cpp: $(shell python3 test_generator.py --output=test_runner.cpp $(TESTS))
test_runner.cpp:
$(shell python3 test_generator.py --output=test_runner.cpp $(TESTS))
@echo MY_VAR IS $(TESTS)
test_runner.o: test_runner.cpp
$(TARGET): $(OBJS) romdisk.o
kos-c++ -o $(TARGET) $(OBJS) romdisk.o
@ -32,3 +35,4 @@ run: $(TARGET)
dist:
rm -f $(OBJS) romdisk.o romdisk.img
$(KOS_STRIP) $(TARGET)

View File

@ -86,7 +86,7 @@ int main(int argc, char* argv[]) {
"""
VERBOSE = False
VERBOSE = True
def log_verbose(message):
if VERBOSE:
@ -165,7 +165,7 @@ def find_tests(files):
# If this subclasses TestCase, or it subclasses any of the already found testcase subclasses
# then add it to the list
if "TestCase" in subclass_names or "SimulantTestCase" in subclass_names or any(x[1] in subclasses[i][2] for x in test_case_subclasses):
if "TestCase" in subclass_names or "GLdcTestCase" in subclass_names or any(x[1] in subclasses[i][2] for x in test_case_subclasses):
if subclasses[i] not in test_case_subclasses:
test_case_subclasses.append(subclasses[i])

View File

@ -1,10 +1,15 @@
#pragma once
#include "../utils/test.h"
namespace {
class NearZClippingTests : gldc::test::GLdcTestCase {
class NearZClippingTests : public gldc::test::GLdcTestCase {
public:
void test_failure() {
assert_false(true);
}
};
}

18
utils/test_parser.py Normal file
View File

@ -0,0 +1,18 @@
import re
import fileinput
import sys
REGEX = "(\d+) tests ([failed|crashed])"
if __name__ == '__main__':
for line in sys.stdin:
print(line, end="")
if re.search(REGEX, line):
print("DETECTED FAILURES")
sys.exit(1)
else:
print("TESTS PASSED!")
sys.exit(0)