File: fix_test_path.patch

package info (click to toggle)
icdiff 1.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 392 kB
  • ctags: 51
  • sloc: python: 436; sh: 106; makefile: 18
file content (45 lines) | stat: -rw-r--r-- 1,321 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Description: fix test paths
 This patch makes it possible to run test using both the version
 in the CWD and in the PATH by setting $INSTALLED in the environment.
 This allows to test the installed version as well as the local one.
Author: Sascha Steinbiss <sascha@steinbiss.name>
Forwarded: https://github.com/jeffkaufman/icdiff/pull/71
--- a/test.sh
+++ b/test.sh
@@ -30,7 +30,7 @@
 fi
 
 PYTHON="$1"
-ICDIFF="./icdiff"
+ICDIFF="icdiff"
 
 function fail() {
   echo "FAIL"
@@ -47,7 +47,11 @@
 
   echo "    check_gold $gold matches $@"
   local tmp=/tmp/icdiff.output
-  "$PYTHON" "$ICDIFF" "$@" &> $tmp
+  if [ ! -z "$INSTALLED" ]; then
+    "$ICDIFF" "$@" &> $tmp
+  else
+    "$PYTHON" "$ICDIFF" "$@" &> $tmp
+  fi
 
   if $REGOLD; then
     if diff $tmp $gold > /dev/null; then
@@ -97,7 +101,13 @@
 check_gold gold-67-ln.txt           tests/input-{6,7}.txt --cols=80 --line-numbers
 check_gold gold-67-u3.txt           tests/input-{6,7}.txt --cols=80 -U 3
 
-if [ $(./icdiff --version | awk '{print $NF}') != $(head -n 1 ChangeLog) ]; then
+
+if [ ! -z "$INSTALLED" ]; then
+  VERSION=$(icdiff --version | awk '{print $NF}')
+else
+  VERSION=$(./icdiff --version | awk '{print $NF}')
+fi
+if [ "$VERSION" != $(head -n 1 ChangeLog) ]; then
   echo "Version mismatch between ChangeLog and icdiff source."
   fail
 fi