Add norminette check and minor QoL changes
authorLukas Jiriste <ljiriste@student.42prague.com>
Tue, 24 Oct 2023 10:14:11 +0000 (12:14 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Tue, 24 Oct 2023 10:14:11 +0000 (12:14 +0200)
Add norminette check as the first thing that runs with test.
Use norminette check to exit test script when the check fails.
Use make exit status to exit test script when compilation fails.
Add -fdiagnostics-color=always flag for compiler errors to retain their
formatting when redirected for later output.

Makefile
test

index dd82e4c829884d03d5cdb2fe41e8ca3f8d36aafa..454df7192215923d06839d7bc143c3488f93dd3d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 CC = cc
-CFLAGS = -Wall -Wextra -Werror -g
+CFLAGS = -Wall -Wextra -Werror -g -fdiagnostics-color=always
 
 GNLDIR = ../
 SRCDIR = src/
@@ -43,3 +43,6 @@ fclean : clean
 
 re : fclean
        $(MAKE)
+
+norminette :
+       norminette $(GNLDIR)
diff --git a/test b/test
index 9072c094f579cfd5d25c3287a814caa5013368a9..e2005d30e8ac62ac673887a890a9a486276b6cea 100755 (executable)
--- a/test
+++ b/test
@@ -2,6 +2,23 @@
 
 git pull
 
+printf "Running Norminette\n"
+make norminette > tmp
+if [ $? -ne 0 ]
+then
+       printf "Norminette error:\n$(<tmp)\n"
+       rm tmp
+       exit 1
+fi
+printf "Compiling without externally providing BUFFER_SIZE\n"
+make --silent 2>tmp
+if [ $? -ne 0 ]
+then
+       printf "Compilation failed:\n$(<tmp)\n"
+       rm tmp
+       exit 1
+fi
+
 mkdir -p correct
 SEP="---------------------"
 wait
@@ -14,9 +31,9 @@ done
 mkdir -p results
 testing_sizes=(1 2 3 4 10 16 42 100 200 500 1000 9999 10000000)
 
-printf "Compiling without externally providing BUFFER_SIZE\n"
-make --silent
+
 wait
+
 for file in $(ls test_files/)
 do
        valgrind --quiet --leak-check=full ./tester $file 2> tmp
@@ -58,5 +75,6 @@ do
                fi
        done
 done
+
 wait
 rm tmp