Add test-lib.sh for our shell test framework
Our test framework is based on Sharness. So the first thing to do is to source it.
Christian Couder committed
Oct 24, 2014 at 21:23 UTC
449523eebd1d2a584d7cfbb6d45bdc28fb8c1898
1 file changed
+34
test/test-lib.sh
new
+34
@@ -0,0 +1,34 @@
1
+# Test framework for go-ipfs
2
+#
3
+# Copyright (c) 2014 Christian Couder
4
+# MIT Licensed; see the LICENSE file in this repository.
5
+#
6
+# We are using sharness (https://github.com/mlafeldt/sharness)
7
+# which was extracted from the Git test framework.
8
+
9
+# You need either sharness to be installed system-wide
10
+# or to set SHARNESS_DIRECTORY properly
11
+
12
+if test -z "$SHARNESS_DIRECTORY"
13
+then
14
+ SHARNESS_DIRECTORY=/usr/local/share/sharness
15
+fi
16
+
17
+SHARNESS_LIB="$SHARNESS_DIRECTORY/sharness.sh"
18
+
19
+test -f "$SHARNESS_LIB" || {
20
+ echo >&2 "Cannot find sharness.sh in: $SHARNESS_DIRECTORY"
21
+ echo >&2 "Please install Sharness system-wide or set the"
22
+ echo >&2 "SHARNESS_DIRECTORY environment variable."
23
+ echo >&2 "See: https://github.com/mlafeldt/sharness"
24
+ exit 1
25
+}
26
+
27
+. "$SHARNESS_LIB" || {
28
+ echo >&2 "Cannot source: $SHARNESS_LIB"
29
+ echo >&2 "Please check Sharness installation."
30
+ exit 1
31
+}
32
+
33
+# Please put go-ipfs specific shell functions below
34
+