commit bb5abea645a31832e9d6a94cea09714a9b1632e3
parent 8059d63339b49d37af894f861956de4b89429bee
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Sun, 19 Nov 2023 11:55:23 +0100
Fixed bug in tests with different architectures
Diffstat:
4 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/configure.sh b/configure.sh
@@ -7,12 +7,9 @@ detectsan() { cc -fsanitize=$1 -dM -E -x c - </dev/null | grep "SANITIZE"; }
TYPE=${TYPE-"$detected"}
-echo "Using CUBE_$TYPE"
-
STD="-std=c99"
WFLAGS="-pedantic -Wall -Wextra -Wno-unused-parameter -Wno-unused-function"
[ "$TYPE" = "AVX2" ] && AVX="-mavx2"
-
[ -n "$(detectsan address)" ] && ADDR="-fsanitize=address"
[ -n "$(detectsan undefined)" ] && UNDEF="-fsanitize=undefined"
SAN="$ADDR $UNDEF"
@@ -20,11 +17,14 @@ SAN="$ADDR $UNDEF"
CFLAGS="$STD $WFLAGS $AVX -O3"
DBGFLAGS="$STD $WFLAGS $AVX -g3 -DDEBUG"
+echo "Cube type: CUBE_$TYPE"
+echo "Compiler: ${CC:-cc}"
+
{
echo "CUBETYPE = CUBE_$TYPE";
echo "";
echo "CFLAGS = $CFLAGS";
echo "DBGFLAGS = $DBGFLAGS";
echo "";
-echo "CC = cc"
+echo "CC = ${CC:-cc}"
} > config.mk
diff --git a/test/020_io_H48_read_write/io_H48_tests.c b/test/020_io_H48_read_write/io_H48_tests.c
@@ -1,11 +1,13 @@
#include "../test.h"
int main(void) {
- char *c, str[STRLENMAX];
+ char str[STRLENMAX], *aux;
cube_t cube;
- for (c = str; (*c = getchar()) != EOF; c++) ;
- *c = '\0';
+ aux = str;
+ while (fgets(aux, STRLENMAX, stdin) != NULL)
+ while (*aux != '\n')
+ aux++;
cube = readcube("H48", str);
diff --git a/test/021_io_SRC_write/io_SRC_tests.c b/test/021_io_SRC_write/io_SRC_tests.c
@@ -1,11 +1,13 @@
#include "../test.h"
int main(void) {
- char *c, str[STRLENMAX];
+ char str[STRLENMAX], *aux;
cube_t cube;
- for (c = str; (*c = getchar()) != EOF; c++) ;
- *c = '\0';
+ aux = str;
+ while (fgets(aux, STRLENMAX, stdin) != NULL)
+ while (*aux != '\n')
+ aux++;
cube = readcube("H48", str);
diff --git a/test/023_io_LST_write/io_LST_tests.c b/test/023_io_LST_write/io_LST_tests.c
@@ -8,11 +8,13 @@ cube_t readcube(char *, char *);
void writecube(char *, cube_t, char *);
int main(void) {
- char *c, str[STRLENMAX];
+ char str[STRLENMAX], *aux;
cube_t cube;
- for (c = str; (*c = getchar()) != EOF; c++) ;
- *c = '\0';
+ aux = str;
+ while (fgets(aux, STRLENMAX, stdin) != NULL)
+ while (*aux != '\n')
+ aux++;
cube = readcube("H48", str);