4 # Copyright (c) 2007, Cameron Rich
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
11 # * Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 # * Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
16 # * Neither the name of the axTLS project nor the names of its
17 # contributors may be used to endorse or promote products derived
18 # from this software without specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26 # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
28 # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 # Test the various axssl bindings. To run it, got to the _install directory
35 # and run this script from there.
38 if grep "CONFIG_PLATFORM_WIN32=y" "../config/.config" > /dev/null; then
39 JAVA_EXE="$JAVA_HOME/bin/java.exe"
40 PERL_BIN="/cygdrive/c/Perl/bin/perl"
47 if grep "CONFIG_PLATFORM_CYGWIN=y" "../config/.config" > /dev/null; then
48 # no .net or java on cygwin
49 PERL_BIN=/usr/bin/perl
50 KILL_AXSSL="killall axssl"
51 KILL_PERL="killall /usr/bin/perl"
52 KILL_LUA="killall /usr/local/bin/lua"
54 JAVA_EXE=/usr/java/default/bin/java
55 PERL_BIN=/usr/bin/perl
56 KILL_AXSSL="killall axssl"
57 KILL_CSHARP="killall mono"
58 KILL_PERL="killall /usr/bin/perl"
60 KILL_JAVA="killall $JAVA_EXE"
61 KILL_LUA="killall /usr/local/bin/lua"
66 SERVER_ARGS="s_server -accept 15001 -verify -CAfile $BASE/ssl/test/axTLS.ca_x509.cer"
67 CLIENT_ARGS="s_client -reconnect -connect localhost:15001 -verify -CAfile $BASE/ssl/test/axTLS.ca_x509.cer -key $BASE/ssl/test/axTLS.key_1024 -cert $BASE/ssl/test/axTLS.x509_1024.cer"
70 SERVER_PEM_ARGS="s_server -accept 15001 -pass abcd -key $BASE/ssl/test/axTLS.key_aes128.pem -cert $BASE/ssl/test/axTLS.x509_aes128.pem"
71 CLIENT_PEM_ARGS="s_client -connect localhost:15001 -CAfile $BASE/ssl/test/axTLS.ca_x509.pem -key $BASE/ssl/test/axTLS.key_1024.pem -cert $BASE/ssl/test/axTLS.x509_1024.pem"
73 export LD_LIBRARY_PATH=.:`perl -e 'use Config; print $Config{archlib};'`/CORE
75 if [ -x ./axssl ]; then
76 echo "############################# C SAMPLE ###########################"
77 ./axssl $SERVER_ARGS &
78 echo "C Test passed" | ./axssl $CLIENT_ARGS
82 ./axssl $SERVER_PEM_ARGS &
83 echo "C Test passed" | ./axssl $CLIENT_PEM_ARGS
86 echo "### C tests complete"
89 if [ -f ./axtls.jar ]; then
90 echo "########################## JAVA SAMPLE ###########################"
91 "$JAVA_EXE" -jar ./axtls.jar $SERVER_ARGS &
92 echo "Java Test passed" | "$JAVA_EXE" -jar ./axtls.jar $CLIENT_ARGS
96 "$JAVA_EXE" -jar ./axtls.jar $SERVER_PEM_ARGS &
97 echo "Java Test passed" | "$JAVA_EXE" -jar ./axtls.jar $CLIENT_PEM_ARGS
101 echo "### Java tests complete"
104 if [ -x ./axssl.csharp.exe ]; then
105 echo "############################ C# SAMPLE ###########################"
106 $RUN_CSHARP ./axssl.csharp.exe $SERVER_ARGS &
107 echo "C# Test passed" | $RUN_CSHARP ./axssl.csharp.exe $CLIENT_ARGS
111 $RUN_CSHARP ./axssl.csharp.exe $SERVER_PEM_ARGS &
112 echo "C# Test passed" | $RUN_CSHARP ./axssl.csharp.exe $CLIENT_PEM_ARGS
116 echo "### C# tests complete"
119 if [ -x ./axssl.vbnet.exe ]; then
120 echo "######################## VB.NET SAMPLE ###########################"
123 ./axssl.vbnet $SERVER_ARGS &
124 echo "VB.NET Test passed" | ./axssl.vbnet.exe $CLIENT_ARGS
128 ./axssl.vbnet $SERVER_PEM_ARGS &
129 echo "VB.NET Test passed" | ./axssl.vbnet.exe $CLIENT_PEM_ARGS
132 echo "### VB.NET tests complete"
135 if [ -f ./axssl.pl ]; then
136 echo "########################## PERL SAMPLE ###########################"
137 "$PERL_BIN" ./axssl.pl $SERVER_ARGS &
138 echo "Perl Test passed" | "$PERL_BIN" ./axssl.pl $CLIENT_ARGS
142 "$PERL_BIN" ./axssl.pl $SERVER_PEM_ARGS &
143 echo "Perl Test passed" | "$PERL_BIN" ./axssl.pl $CLIENT_PEM_ARGS
146 echo "### Perl tests complete"
149 if [ -f ./axssl.lua ]; then
150 echo "########################## LUA SAMPLE ###########################"
151 ./axssl.lua $SERVER_ARGS &
152 echo "Lua Test passed" | ./axssl.lua $CLIENT_ARGS
156 ./axssl.lua $SERVER_PEM_ARGS &
157 echo "Lua Test passed" | ./axssl.lua $CLIENT_PEM_ARGS
160 echo "### Lua tests complete"
163 echo "########################## ALL TESTS COMPLETE ###########################"