This repository has been archived by the owner on May 8, 2022. It is now read-only.
forked from jakobandersen/mod
/
testJLA.sh
executable file
·134 lines (132 loc) · 3.19 KB
/
testJLA.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
export AS_RLIMIT=300000000
root_PWD=$(pwd)
numThreads=2
doBuild="yes"
withOpenBabel="yes"
prefix="--prefix=$HOME/test/modTestInstall"
while true; do
case $1 in
-j)
if [ "x$2" = "x" ]; then
echo "Missing argument for '$1'"
exit 1
fi
numThreads=$2
shift
shift
;;
"nooptional")
withOpenBabel="no"
shift
;;
"noobabel")
withOpenBabel="no"
shift
;;
"nobuild")
doBuild="no"
shift
;;
"--prefix="*)
prefix=$1
shift
;;
"")
break
;;
*)
echo "Unknown option '$1'"
exit 1
esac
done
args=""
if test "$withOpenBabel" = "yes"; then
#args="$args --with-OpenBabel=$HOME/programs"
# Use the repo version now.
args="$args --with-OpenBabel=yes"
else
args="$args --with-OpenBabel=no"
fi
args="$args --with-boost=$HOME/programs$suffix"
args="$args $prefix $@"
./repo-bootstrap.sh \
&& rm -rf preBuild && mkdir preBuild \
&& cd preBuild && ../configure $args \
&& make dist \
&& cd .. && rm -rf build && mkdir build \
&& cd build \
&& cp ../preBuild/mod-*.tar.gz ./ \
&& tar xzf mod-*.tar.gz && cd mod-* \
&& mkdir build && cd build \
&& ../configure $args
res=$?
if [ $res -ne 0 ]; then
echo "Error during configuration"
exit $res
fi
if [ "$doBuild" = "no" ]; then
echo "Not building due to user request"
else
time make -j $numThreads \
&& rm -rf $HOME/test/modTestInstall \
&& make install
res=$?
if [ $res -ne 0 ]; then
echo "Error during installation"
exit $res
fi
function makeSource {
cd $root_PWD/src
for f in $(ls mod/*.h | grep -v BuildConfig.h); do
echo "#include <$f>"
done
echo ""
echo "#include <iostream>"
echo ""
echo "int main() {"
echo " auto g = mod::Graph::graphDFS(\"[T]\");"
echo " std::cout << \"Graph name: \" << g->getName() << std::endl;"
echo " return 0;"
echo "}"
}
function makeMakefile {
echo 'PKG_CONFIG_PATH := $(PKG_CONFIG_PATH):$(HOME)/test/modTestInstall/lib/pkgconfig'
echo 'CPPFLAGS := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --cflags mod)'
echo 'CXXFLAGS := -std=c++14'
echo 'LDLIBS := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs mod)'
echo ""
echo "test: test.o"
echo ' $(CXX) -o test test.o $(LDLIBS)'
}
rm -rf $HOME/test/modTestCompile
mkdir $HOME/test/modTestCompile
makeSource > $HOME/test/modTestCompile/test.cpp
makeMakefile > $HOME/test/modTestCompile/Makefile
cd $HOME/test/modTestCompile
echo "Test program:"
echo "======================================================================"
cat test.cpp
echo "======================================================================"
echo "Makefile:"
echo "======================================================================"
cat Makefile
echo "======================================================================"
make && ./test
res=$?
if [ $res -ne 0 ]; then
echo "Compilation or run of test program failed."
exit $res
fi
echo "Test wrapper"
echo "======================================================================"
$HOME/test/modTestInstall/bin/mod -e "smiles('O').print()"
res=$?
if [ $res -ne 0 ]; then
echo "Running the wrapper script failed."
exit $res
fi
fi
cd $root_PWD/build/mod-*
cd build
make install-doc