From 16948fbd9c34e347b7bd8d0984e4c572377210c4 Mon Sep 17 00:00:00 2001 From: Jeremiah Orians Date: Sun, 21 Nov 2021 17:16:42 -0500 Subject: [PATCH] Minimal sanity test --- .gitignore | 9 +-------- makefile | 11 ++++++----- test/test0000/proof.answer | 1 + test/test0000/return.c | 21 +++++++++++++++++++++ test/test0000/run_test.sh | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 test/test0000/proof.answer create mode 100644 test/test0000/return.c create mode 100755 test/test0000/run_test.sh diff --git a/.gitignore b/.gitignore index f0435dc..17a74b2 100644 --- a/.gitignore +++ b/.gitignore @@ -14,13 +14,6 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . -# Generated files -tape_01 -tape_02 - # Directories storing data that should be ignored bin/ -temp/ -test/scratch/ -scratch/ - +test/*/tmp/ diff --git a/makefile b/makefile index 39f34d2..00c1852 100644 --- a/makefile +++ b/makefile @@ -16,8 +16,8 @@ ## along with M2-Mesoplanet. If not, see . # Prevent rebuilding -VPATH = bin:test:test/results -PACKAGE = m2-planet +VPATH = bin +PACKAGE = m2-mesoplanet # C compiler settings CC?=gcc @@ -40,7 +40,7 @@ M2-Mesoplanet: bin results cc.h cc_reader.c cc_core.c cc.c cc_globals.c cc_globa # Clean up after ourselves .PHONY: clean clean: - rm -rf bin/ test/results/ + rm -rf bin/ # ./test/test0000/cleanup.sh # Directories @@ -51,8 +51,9 @@ results: mkdir -p test/results # tests -test: aarch64-tests amd64-tests knight-posix-tests knight-native-tests armv7l-tests x86-tests | results - sha256sum -c test/test.answers +test: M2-Mesoplanet + ./test/test0000/run_test.sh +# sha256sum -c test/test.answers # Generate test answers diff --git a/test/test0000/proof.answer b/test/test0000/proof.answer new file mode 100644 index 0000000..8c07e4b --- /dev/null +++ b/test/test0000/proof.answer @@ -0,0 +1 @@ +e98ce4032c30d918c1fc4f7132567af790692e1a87123c5843f0001fc24447ad test/test0000/tmp/return.c diff --git a/test/test0000/return.c b/test/test0000/return.c new file mode 100644 index 0000000..4ab841d --- /dev/null +++ b/test/test0000/return.c @@ -0,0 +1,21 @@ +/* Copyright (C) 2016 Jeremiah Orians + * This file is part of M2-Planet. + * + * M2-Planet is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * M2-Planet is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with M2-Planet. If not, see . + */ + +int main() +{ + return 42; +} diff --git a/test/test0000/run_test.sh b/test/test0000/run_test.sh new file mode 100755 index 0000000..be1dde2 --- /dev/null +++ b/test/test0000/run_test.sh @@ -0,0 +1,32 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## Copyright (C) 2020-2021 deesix +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +set -x + +TMPDIR="test/test0000/tmp" + +mkdir -p ${TMPDIR} + +# Build the test +bin/M2-Mesoplanet \ + -f test/test0000/return.c \ + -o ${TMPDIR}/return.c \ + || exit 1 + +sha256sum -c test/test0000/proof.answer || exit 2 +exit 0