From adde2bbad645d05c1e4e15b3826befd0d7a9bbdf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Thu, 24 Nov 2011 20:43:12 +0100
Subject: [PATCH] * examples/Makefile.in (check): Pass $(EMULATOR) and
 $(EXEEXT) in the environment of run-tests. * examples/rsa-encrypt-test: Use
 $EXEEXT and $EMULATOR. * examples/rsa-sign-test: Likewise. *
 examples/rsa-verify-test: Likewise. * examples/setup-env: Likewise.

Rev: nettle/examples/Makefile.in:1.10
Rev: nettle/examples/rsa-encrypt-test:1.2
Rev: nettle/examples/rsa-sign-test:1.2
Rev: nettle/examples/rsa-verify-test:1.2
Rev: nettle/examples/setup-env:1.2
Rev: nettle/examples/teardown-env:1.2
---
 examples/Makefile.in      |  3 ++-
 examples/rsa-encrypt-test |  6 +++---
 examples/rsa-sign-test    |  4 ++--
 examples/rsa-verify-test  | 10 +++++-----
 examples/setup-env        |  4 ++--
 examples/teardown-env     |  3 ++-
 6 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/examples/Makefile.in b/examples/Makefile.in
index a3b07905..211600ed 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -75,7 +75,8 @@ $(TARGETS) : io.$(OBJEXT) ../libnettle.a
 
 check: $(TS_ALL)
 	LD_LIBRARY_PATH=../.lib srcdir="$(srcdir)" \
-	  "$(srcdir)"/run-tests $(TS_ALL)
+	  EMULATOR="$(EMULATOR)" EXEEXT="$(EXEEXT)" \
+          "$(srcdir)"/run-tests $(TS_ALL)
 
 Makefile: $(srcdir)/Makefile.in ../config.status
 	cd .. && $(SHELL) ./config.status examples/$@
diff --git a/examples/rsa-encrypt-test b/examples/rsa-encrypt-test
index 08b7a447..ff935fb0 100755
--- a/examples/rsa-encrypt-test
+++ b/examples/rsa-encrypt-test
@@ -6,13 +6,13 @@ fi
 
 data="$srcdir/nettle-benchmark.c"
 
-if [ -x rsa-encrypt ] ; then
-  if ./rsa-encrypt -r rsa-decrypt testkey.pub < "$data" > testciphertext ; then
+if [ -x rsa-encrypt$EXEEXT ] ; then
+  if $EMULATOR ./rsa-encrypt -r rsa-decrypt$EXEEXT testkey.pub < "$data" > testciphertext ; then
     :
   else
     exit 1
   fi
-  if ./rsa-decrypt testkey < testciphertext > testcleartext ; then
+  if $EMULATOR ./rsa-decrypt testkey < testciphertext > testcleartext ; then
     :
   else
     exit 1
diff --git a/examples/rsa-sign-test b/examples/rsa-sign-test
index 16212269..99d90dfc 100755
--- a/examples/rsa-sign-test
+++ b/examples/rsa-sign-test
@@ -6,8 +6,8 @@ fi
 
 data="$srcdir/nettle-benchmark.c"
 
-if [ -x rsa-sign ] ; then
-  if ./rsa-sign testkey < "$data" > testsignature ; then
+if [ -x rsa-sign$EXEEXT ] ; then
+  if $EMULATOR ./rsa-sign testkey < "$data" > testsignature ; then
     exit 0;
   else
     exit 1
diff --git a/examples/rsa-verify-test b/examples/rsa-verify-test
index 765b61f5..13c143cb 100755
--- a/examples/rsa-verify-test
+++ b/examples/rsa-verify-test
@@ -6,21 +6,21 @@ fi
 
 data="$srcdir/nettle-benchmark.c"
 
-if [ -x rsa-verify ] ; then
-  ./rsa-sign testkey < "$data" > testsignature \
-    && ./rsa-verify testkey.pub testsignature < "$data" \
+if [ -x rsa-verify$EXEEXT ] ; then
+  $EMULATOR ./rsa-sign testkey < "$data" > testsignature \
+    && $EMULATOR ./rsa-verify testkey.pub testsignature < "$data" \
     || exit 1;
   
   # Try modifying the data
   sed s/128/129/ < "$data" >testdata
 
-  if ./rsa-verify testkey.pub testsignature < testdata 2>/dev/null; then
+  if $EMULATOR ./rsa-verify testkey.pub testsignature < testdata 2>/dev/null; then
     exit 1
   fi
   
   # Try modifying the signature
   sed s/1/2/ <testsignature > testsignature2
-  if ./rsa-verify testkey.pub testsignature2 < "$data" 2>/dev/null; then
+  if $EMULATOR ./rsa-verify testkey.pub testsignature2 < "$data" 2>/dev/null; then
     exit 1;
   fi
   exit 0
diff --git a/examples/setup-env b/examples/setup-env
index 7588d6f8..3ebef2c8 100755
--- a/examples/setup-env
+++ b/examples/setup-env
@@ -2,6 +2,6 @@
 
 set -e
 
-if [ -x rsa-keygen ] ; then
-  ./rsa-keygen -r rsa-decrypt -o testkey || exit 1
+if [ -x rsa-keygen$EXEEXT ] ; then
+  $EMULATOR ./rsa-keygen -r rsa-decrypt$EXEEXT -o testkey || exit 1
 fi
diff --git a/examples/teardown-env b/examples/teardown-env
index ce1a157b..496c8cc5 100755
--- a/examples/teardown-env
+++ b/examples/teardown-env
@@ -1,6 +1,7 @@
 #! /bin/sh
 
-rm -rf testkey testkey.pub testsignature testsignature2 testdata \
+rm -rf testkey testkey.pub testsignature testsignature2 \
+    testdata testtmp \
     testciphertext testcleartext
 
 
-- 
GitLab