-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I knowingly broke it while hacking on the lib effort, but then promptly forgot to fix it. It is now fixed, and nicer to use. Just invoke via make: make test -j6 suite=vecmath suite is optional, omit it to run all tests in all suites.
- Loading branch information
Showing
12 changed files
with
80 additions
and
78 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 was deleted.
Oops, something went wrong.
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,37 @@ | ||
#!/bin/bash | ||
|
||
if [[ $# -eq 1 ]]; then | ||
suite=$1 | ||
count=$(./tests/testrunner --suite "$suite" --tcount) | ||
else | ||
count=$(./tests/testrunner --tcount) | ||
fi | ||
|
||
|
||
echo "c-ray tiny test runner v0.3" | ||
echo "Running $count tests." | ||
|
||
failed_tests=0 | ||
|
||
i=0; while [ $i -le $((count - 1)) ]; do | ||
if [[ -n "$suite" ]]; then | ||
output=$(./tests/testrunner --suite "$suite" --test $i) | ||
else | ||
output=$(./tests/testrunner --test $i) | ||
fi | ||
if [[ $? -eq 0 ]] | ||
then | ||
echo "$output" | ||
else | ||
echo "$output" | ||
failed_tests=$(( failed_tests + 1 )) | ||
fi | ||
i=$(( i + 1 )) | ||
done | ||
echo "Test suite finished. $((i - failed_tests))/$i tests passed." | ||
if [[ $failed_tests -ne 0 ]] | ||
then | ||
exit 1 | ||
else | ||
exit 0 | ||
fi |
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,22 @@ | ||
BIN_test=tests/testrunner | ||
OBJDIR_test=tests/obj | ||
SRCS_test=$(shell find src/lib src/driver src/common generated/ tests/ -name '*.c' -not -name 'main.c') | ||
TEST_HDRS=$(shell find tests/ -name '*.h') | ||
OBJS_test=$(patsubst %.c, $(OBJDIR_test)/%.o, $(SRCS_test)) | ||
# suite=vector | ||
|
||
test: $(BIN_test) | ||
tests/runner.sh $(suite) | ||
|
||
$(OBJDIR_test)/%.o: %.c $(TEST_HDRS) $(OBJDIR_test) | ||
@mkdir -p '$(@D)' | ||
@echo "CC $<" | ||
@$(CC) $(CFLAGS) -DCRAY_TESTING -c $< -o $@ | ||
$(OBJDIR_test): | ||
mkdir -p $@ | ||
$(BIN_test): $(OBJS_test) $(OBJDIR_test) | ||
@echo "LD $@" | ||
@$(CC) $(CFLAGS) $(OBJS_test) -o $@ $(LDFLAGS) | ||
|
||
clean_test: | ||
rm -rf tests/obj tests/testrunner |
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
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 |
---|---|---|
@@ -1,22 +1,18 @@ | ||
// | ||
// testrunner.h | ||
// C-ray | ||
// c-ray | ||
// | ||
// Created by Valtteri on 23.6.2020. | ||
// Copyright © 2020-2021 Valtteri Koskivuori. All rights reserved. | ||
// Copyright © 2020-2024 Valtteri Koskivuori. All rights reserved. | ||
// | ||
|
||
#pragma once | ||
|
||
/* | ||
C-ray integrated testing system. | ||
*/ | ||
// c-ray integrated testing system. | ||
|
||
#ifdef CRAY_TESTING | ||
int runTests(char *suite); | ||
int runPerfTests(char *suite); | ||
int runTest(unsigned test, char *suite); | ||
int runPerfTest(unsigned test, char *suite); | ||
int getTestCount(char *suite); | ||
int getPerfTestCount(char *suite); | ||
#endif |