summary refs log tree commit diff
path: root/gnu/packages/patches/e9patch-check.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/e9patch-check.patch')
-rw-r--r--gnu/packages/patches/e9patch-check.patch167
1 files changed, 167 insertions, 0 deletions
diff --git a/gnu/packages/patches/e9patch-check.patch b/gnu/packages/patches/e9patch-check.patch
new file mode 100644
index 0000000000..2c36df9a7b
--- /dev/null
+++ b/gnu/packages/patches/e9patch-check.patch
@@ -0,0 +1,167 @@
+diff --git a/Makefile b/Makefile
+index 1218c65d1818..b7a0e3edbc75 100644
+--- a/Makefile
++++ b/Makefile
+@@ -181,3 +181,12 @@ tool.sanitize: $(E9TOOL_OBJS) $(E9TOOL_LIBS)
+ 	$(CXX) $(CXXFLAGS) $(E9TOOL_OBJS) $(E9TOOL_LIBS) -o e9tool \
+         $(E9TOOL_LDFLAGS)
+ 
++regtest: e9tool
++	$(MAKE) -C test/regtest
++
++stresstest: e9tool
++	$(MAKE) -C test/stresstest
++
++check: regtest # stresstest
++
++.PHONY: regtest stresstest check
+diff --git a/test/regtest/Makefile b/test/regtest/Makefile
+index 992b1bc40984..142d29e54276 100644
+--- a/test/regtest/Makefile
++++ b/test/regtest/Makefile
+@@ -3,32 +3,63 @@ FCF_NONE := $(shell \
+         then true; \
+         else echo -fcf-protection=none; fi)
+ 
+-all:
++check: regtest test test.pie test.libc test_c test_c.debug bugs inst patch dl init fini example.so
++	./$<
++
++test:
+ 	gcc -x assembler-with-cpp -o test test.s -no-pie -nostdlib \
+         -Wl,--section-start=.text=0xa000000 -Wl,--section-start=.bss=0xc000000 \
+         -Wl,-z -Wl,max-page-size=4096 -DPIE=0
++
++test.pie:
+ 	gcc -x assembler-with-cpp -o test.pie test.s -pie -nostdlib \
+         -Wl,--section-start=.text=0xa000000 -Wl,--section-start=.bss=0xc000000 \
+         -Wl,-z -Wl,max-page-size=4096 -DPIE=1 \
+ 		-Wl,--export-dynamic
++
++bugs:
+ 	gcc -x assembler-with-cpp -o bugs bugs.s -no-pie -nostdlib \
+         -Wl,--section-start=.text=0xa000000 -Wl,--section-start=.bss=0xc000000 \
+         -Wl,-z -Wl,max-page-size=4096 -DPIE=0
++
++test.libc:
+ 	gcc -x assembler-with-cpp -o test.libc test_libc.s -pie -Wl,--export-dynamic
++
++libtest.so:
+ 	gcc -x assembler-with-cpp -shared -o libtest.so libtest.s 
++
++test_c:
+ 	gcc -O2 -fPIC $(FCF_NONE) -pie -o test_c test_c.c \
+ 		-Wl,--export-dynamic -U_FORTIFY_SOURCE
+ 	strip test_c
++
++test_c.debug:
+ 	gcc -O0 -g -fPIC -pie -o test_c.debug test_c.c
++
++inst:
+ 	../../e9compile.sh inst.c -I ../../examples/ 
++
++patch:
+ 	../../e9compile.sh patch.cpp -std=c++11 -I ../../examples/ 
++
++dl:
+ 	NO_SIMD_CHECK=1 ../../e9compile.sh dl.c -I ../../examples/
++
++init:
+ 	../../e9compile.sh init.c -I ../../examples/ 
++
++fini:
+ 	../../e9compile.sh fini.c -I ../../examples/
++
++example.so:
+ 	g++ -std=c++11 -fPIC -shared -o example.so -O2 \
+         ../../examples/plugins/example.cpp -I ../../src/e9tool/
++
++regtest:
+ 	g++ -std=c++11 -pie -fPIC -o regtest regtest.cpp -O2
+ 
+ clean:
+ 	rm -f *.log *.out *.exe test test.pie test.libc libtest.so inst inst.o \
+         patch patch.o init init.o regtest
++
++.PHONY: check clean
+diff --git a/test/regtest/regtest.cpp b/test/regtest/regtest.cpp
+index e86e0af03228..9d78f9c6d670 100644
+--- a/test/regtest/regtest.cpp
++++ b/test/regtest/regtest.cpp
+@@ -164,11 +164,11 @@ static bool runTest(const struct dirent *test, const std::string &options)
+         {
+             fclose(OUT); fclose(EXP);
+             command.clear();
+-            command += "diff ";
++            command += "diff -u ";
+             command += out;
+             command += ' ';
+             command += exp;
+-            command += " >";
++            command += " | tee ";
+             command += diff;
+             printf("\t%s\n", command.c_str());
+             (void)system(command.c_str());
+diff --git a/test/stresstest/Makefile b/test/stresstest/Makefile
+index 64bcb5432a0e..2c8b98e7577c 100644
+--- a/test/stresstest/Makefile
++++ b/test/stresstest/Makefile
+@@ -1,2 +1,15 @@
++ROOT_DIR = ../..
++
++check: stresstest.sh nop example.so
++	./$<
++
++nop: $(ROOT_DIR)/e9compile.sh $(ROOT_DIR)/examples/nop.c
++	$^
++
++example.so: $(ROOT_DIR)/examples/plugins/example.cpp
++	g++ -std=c++11 -fPIC -shared -I$(ROOT_DIR)/src/e9tool -o $@ -O2 $<
++
+ clean:
+ 	rm -rf example.so nop nop.o tmp
++
++.PHONY: check clean
+diff --git a/test/stresstest/stresstest.sh b/test/stresstest/stresstest.sh
+index 86ac9e0db1f4..be4048f52f27 100755
+--- a/test/stresstest/stresstest.sh
++++ b/test/stresstest/stresstest.sh
+@@ -1,4 +1,5 @@
+-#!/bin/bash
++#!/bin/sh
++set -e
+ 
+ if [ -t 1 ]
+ then
+@@ -15,20 +16,14 @@ else
+     OFF=
+ fi
+ 
+-set -e
+-mkdir -p tmp
+-../../e9compile.sh ../../examples/nop.c >/dev/null 2>&1 
+-
+-# Setup the example.so plugin
+-g++ -std=c++11 -fPIC -shared -o example.so -O2 \
+-    ../../examples/plugins/example.cpp -I ../../src/e9tool/ 
+-
+ runtest()
+ {
+     MATCH=$1
+     PATCH=$2
+     EXTRA=$3
+ 
++    mkdir tmp
++
+     # Step (1): duplicate the tools
+     if ! ../../e9tool ../../e9tool "--match=$MATCH" "--patch=$PATCH" $EXTRA \
+             -o tmp/e9tool.patched  -c 6 -s >/dev/null 2>&1
+@@ -72,6 +67,8 @@ runtest()
+     else
+         echo -e "${RED}FAILED${OFF}: e9patch ${YELLOW}-M $MATCH -P $PATCH${OFF}"
+     fi
++
++    rm -r tmp
+ }
+ 
+ runtest true empty