From: mrdudz Date: Mon, 24 Nov 2014 19:57:58 +0000 (+0100) Subject: use own naive bdiff tool instead of diff/fc X-Git-Tag: V2.15~29^2~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8a558a7ceff17a380fb8930f7f1dc4db85d42d16;p=cc65 use own naive bdiff tool instead of diff/fc --- diff --git a/test/Makefile b/test/Makefile index d71d5fda4..f5f10c029 100644 --- a/test/Makefile +++ b/test/Makefile @@ -3,9 +3,26 @@ MAKE := make --no-print-dir -.PHONY: all clean +ifneq ($(shell echo),) + CMD_EXE = 1 +endif -all: +ifdef CMD_EXE +RM := del /f +EXE := .exe +else +RM := rm -f +EXE := +endif + +.PHONY: dotests clean + +all: dotests + +bdiff: + @$(CC) -o bdiff$(EXE) bdiff.c + +dotests: bdiff @$(MAKE) -C val clean all @$(MAKE) -C ref clean all @$(MAKE) -C err clean all @@ -16,4 +33,4 @@ clean: @$(MAKE) -C ref clean @$(MAKE) -C err clean @$(MAKE) -C misc clean - + @$(RM) bdiff$(EXE) diff --git a/test/bdiff.c b/test/bdiff.c new file mode 100644 index 000000000..797ba4302 --- /dev/null +++ b/test/bdiff.c @@ -0,0 +1,28 @@ + +// minimal tool to compare two binaries + +#include +#include + +int main(int argc, char *argv[]) +{ + FILE *f1, *f2; + if (argc < 3) { + return EXIT_FAILURE; + } + f1 = fopen(argv[1], "rb"); + f2 = fopen(argv[2], "rb"); + if ((f1 == NULL) || (f2 == NULL)) { + return EXIT_FAILURE; + } + for(;;) { + if (feof(f1) && feof(f2)) { + return EXIT_SUCCESS; + } else if (feof(f1) || feof(f2)) { + return EXIT_FAILURE; + } + if (fgetc(f1) != fgetc(f2)) { + return EXIT_FAILURE; + } + } +} diff --git a/test/misc/Makefile b/test/misc/Makefile index b9e4637d0..e3d60269d 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -13,12 +13,12 @@ SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) ifdef CMD_EXE RM := del /f -DIFF := fc else RM := rm -f -DIFF := diff -q endif +DIFF := ./../bdiff + .PHONY: all clean TESTS := $(patsubst %.c,%.prg,$(wildcard *.c)) diff --git a/test/ref/Makefile b/test/ref/Makefile index b3b555aef..ccb52c3ba 100644 --- a/test/ref/Makefile +++ b/test/ref/Makefile @@ -14,12 +14,12 @@ SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65) ifdef CMD_EXE RM := del /f -DIFF := fc else RM := rm -f -DIFF := diff -q endif +DIFF := ./../bdiff + CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow .PHONY: all clean