Annotation of embedaddon/axTLS/ssl/test/test_axssl.sh, revision 1.1
1.1 ! misho 1: #!/bin/sh
! 2:
! 3: #
! 4: # Copyright (c) 2007, Cameron Rich
! 5: #
! 6: # All rights reserved.
! 7: #
! 8: # Redistribution and use in source and binary forms, with or without
! 9: # modification, are permitted provided that the following conditions are met:
! 10: #
! 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.
! 19: #
! 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.
! 31: #
! 32:
! 33: #
! 34: # Test the various axssl bindings. To run it, got to the _install directory
! 35: # and run this script from there.
! 36: #
! 37:
! 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"
! 41: KILL_AXSSL="kill %1"
! 42: KILL_CSHARP="kill %1"
! 43: KILL_PERL="kill %1"
! 44: KILL_JAVA="kill %1"
! 45: KILL_LUA="kill %1"
! 46: else
! 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"
! 53: else # Linux
! 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"
! 59: RUN_CSHARP="mono"
! 60: KILL_JAVA="killall $JAVA_EXE"
! 61: KILL_LUA="killall /usr/local/bin/lua"
! 62: fi
! 63: fi
! 64:
! 65: BASE=..
! 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"
! 68:
! 69: # check pem arguments
! 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"
! 72:
! 73: export LD_LIBRARY_PATH=.:`perl -e 'use Config; print $Config{archlib};'`/CORE
! 74:
! 75: if [ -x ./axssl ]; then
! 76: echo "############################# C SAMPLE ###########################"
! 77: ./axssl $SERVER_ARGS &
! 78: echo "C Test passed" | ./axssl $CLIENT_ARGS
! 79: $KILL_AXSSL
! 80: sleep 1
! 81:
! 82: ./axssl $SERVER_PEM_ARGS &
! 83: echo "C Test passed" | ./axssl $CLIENT_PEM_ARGS
! 84: $KILL_AXSSL
! 85: sleep 1
! 86: echo "### C tests complete"
! 87: fi
! 88:
! 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
! 93: $KILL_JAVA
! 94: sleep 1
! 95:
! 96: "$JAVA_EXE" -jar ./axtls.jar $SERVER_PEM_ARGS &
! 97: echo "Java Test passed" | "$JAVA_EXE" -jar ./axtls.jar $CLIENT_PEM_ARGS
! 98: $KILL_JAVA
! 99: sleep 1
! 100:
! 101: echo "### Java tests complete"
! 102: fi
! 103:
! 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
! 108: $KILL_CSHARP
! 109: sleep 1
! 110:
! 111: $RUN_CSHARP ./axssl.csharp.exe $SERVER_PEM_ARGS &
! 112: echo "C# Test passed" | $RUN_CSHARP ./axssl.csharp.exe $CLIENT_PEM_ARGS
! 113: $KILL_CSHARP
! 114: sleep 1
! 115:
! 116: echo "### C# tests complete"
! 117: fi
! 118:
! 119: if [ -x ./axssl.vbnet.exe ]; then
! 120: echo "######################## VB.NET SAMPLE ###########################"
! 121: echo $SERVER_ARGS
! 122: echo $CLIENT_ARGS
! 123: ./axssl.vbnet $SERVER_ARGS &
! 124: echo "VB.NET Test passed" | ./axssl.vbnet.exe $CLIENT_ARGS
! 125: kill %1
! 126: sleep 1
! 127:
! 128: ./axssl.vbnet $SERVER_PEM_ARGS &
! 129: echo "VB.NET Test passed" | ./axssl.vbnet.exe $CLIENT_PEM_ARGS
! 130: kill %1
! 131: sleep 1
! 132: echo "### VB.NET tests complete"
! 133: fi
! 134:
! 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
! 139: $KILL_PERL
! 140: sleep 1
! 141:
! 142: "$PERL_BIN" ./axssl.pl $SERVER_PEM_ARGS &
! 143: echo "Perl Test passed" | "$PERL_BIN" ./axssl.pl $CLIENT_PEM_ARGS
! 144: $KILL_PERL
! 145: sleep 1
! 146: echo "### Perl tests complete"
! 147: fi
! 148:
! 149: if [ -f ./axssl.lua ]; then
! 150: echo "########################## LUA SAMPLE ###########################"
! 151: ./axssl.lua $SERVER_ARGS &
! 152: echo "Lua Test passed" | ./axssl.lua $CLIENT_ARGS
! 153: $KILL_LUA
! 154: sleep 1
! 155:
! 156: ./axssl.lua $SERVER_PEM_ARGS &
! 157: echo "Lua Test passed" | ./axssl.lua $CLIENT_PEM_ARGS
! 158: $KILL_LUA
! 159: sleep 1
! 160: echo "### Lua tests complete"
! 161: fi
! 162:
! 163: echo "########################## ALL TESTS COMPLETE ###########################"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>