Merge branch 'appveyor'

Build and run unit tests on AppVeyor Windows containers.
This commit is contained in:
Tobias Brunner 2017-08-02 16:51:40 +02:00
commit 8f63a36b34
5 changed files with 48 additions and 12 deletions

25
.appveyor.yml Normal file
View File

@ -0,0 +1,25 @@
clone_depth: 50
environment:
global:
TESTS_REDUCED_KEYLENGTHS: yes
LEAK_DETECTIVE: no
MONOLITHIC: yes
TZ: Europe/Zurich
matrix:
- arch: x86_64
bits: 64
# no 32-bit build as 32-bit msys is not installed
#- arch: i686
# bits: 32
install:
- set MSYS_SH=C:\msys%BITS%\usr\bin\sh.exe
- set MSYSTEM=MINGW%BITS%
- set TEST=win%BITS%
build_script:
- '%MSYS_SH% --login -c ". /etc/profile && cd $APPVEYOR_BUILD_FOLDER && ./scripts/test.sh deps"'
test_script:
- '%MSYS_SH% --login -c ". /etc/profile && cd $APPVEYOR_BUILD_FOLDER && ./scripts/test.sh"'

View File

@ -64,8 +64,15 @@ win*)
--enable-tnccs-20 --enable-imc-attestation --enable-imv-attestation --enable-tnccs-20 --enable-imc-attestation --enable-imv-attestation
--enable-imc-os --enable-imv-os --enable-tnc-imv --enable-tnc-imc --enable-imc-os --enable-imv-os --enable-tnc-imv --enable-tnc-imc
--enable-pki --enable-swanctl --enable-socket-win" --enable-pki --enable-swanctl --enable-socket-win"
# no make check for Windows binaries # no make check for Windows binaries unless we run on a windows host
if test "$APPVEYOR" != "True"; then
TARGET= TARGET=
else
CONFIG="$CONFIG --enable-openssl"
CFLAGS="$CFLAGS -I/c/OpenSSL-$TEST/include"
LDFLAGS="-L/c/OpenSSL-$TEST"
export LDFLAGS
fi
CFLAGS="$CFLAGS -mno-ms-bitfields" CFLAGS="$CFLAGS -mno-ms-bitfields"
DEPS="gcc-mingw-w64-base" DEPS="gcc-mingw-w64-base"
case "$TEST" in case "$TEST" in
@ -76,7 +83,7 @@ win*)
DEPS="gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev $DEPS" DEPS="gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev $DEPS"
CC="x86_64-w64-mingw32-gcc" CC="x86_64-w64-mingw32-gcc"
# apply patch to MinGW headers # apply patch to MinGW headers
if test -z "$1"; then if test "$APPVEYOR" != "True" -a -z "$1"; then
sudo patch -f -p 4 -d /usr/share/mingw-w64/include < src/libcharon/plugins/kernel_wfp/mingw-w64-4.8.1.diff sudo patch -f -p 4 -d /usr/share/mingw-w64/include < src/libcharon/plugins/kernel_wfp/mingw-w64-4.8.1.diff
fi fi
;; ;;

View File

@ -285,7 +285,7 @@ bool exchange_test_asserts_message(listener_t *this, ike_sa_t *ike_sa,
* @param dir IN or OUT to check the next in- or outbound message * @param dir IN or OUT to check the next in- or outbound message
*/ */
#define assert_message_empty(dir) \ #define assert_message_empty(dir) \
_assert_payload(dir, 0) _assert_payload(#dir, 0)
/** /**
* Assert that the next in- or outbound plaintext message contains exactly * Assert that the next in- or outbound plaintext message contains exactly
@ -295,7 +295,7 @@ bool exchange_test_asserts_message(listener_t *this, ike_sa_t *ike_sa,
* @param expected expected payload type * @param expected expected payload type
*/ */
#define assert_single_payload(dir, expected) \ #define assert_single_payload(dir, expected) \
_assert_payload(dir, 1, { TRUE, expected, 0 }) _assert_payload(#dir, 1, { TRUE, expected, 0 })
/** /**
* Assert that the next in- or outbound plaintext message contains exactly * Assert that the next in- or outbound plaintext message contains exactly
@ -305,7 +305,7 @@ bool exchange_test_asserts_message(listener_t *this, ike_sa_t *ike_sa,
* @param expected expected notify type * @param expected expected notify type
*/ */
#define assert_single_notify(dir, expected) \ #define assert_single_notify(dir, expected) \
_assert_payload(dir, 1, { TRUE, 0, expected }) _assert_payload(#dir, 1, { TRUE, 0, expected })
/** /**
* Assert that the next in- or outbound plaintext message contains a notify * Assert that the next in- or outbound plaintext message contains a notify
@ -315,7 +315,7 @@ bool exchange_test_asserts_message(listener_t *this, ike_sa_t *ike_sa,
* @param expected expected notify type * @param expected expected notify type
*/ */
#define assert_notify(dir, expected) \ #define assert_notify(dir, expected) \
_assert_payload(dir, -1, { TRUE, 0, expected }) _assert_payload(#dir, -1, { TRUE, 0, expected })
/** /**
* Assert that the next in- or outbound plaintext message does not contain a * Assert that the next in- or outbound plaintext message does not contain a
@ -325,7 +325,7 @@ bool exchange_test_asserts_message(listener_t *this, ike_sa_t *ike_sa,
* @param unexpected not expected notify type * @param unexpected not expected notify type
*/ */
#define assert_no_notify(dir, unexpected) \ #define assert_no_notify(dir, unexpected) \
_assert_payload(dir, -1, { FALSE, 0, unexpected }) _assert_payload(#dir, -1, { FALSE, 0, unexpected })
#define _assert_payload(dir, c, ...) ({ \ #define _assert_payload(dir, c, ...) ({ \
listener_message_rule_t _rules[] = { __VA_ARGS__ }; \ listener_message_rule_t _rules[] = { __VA_ARGS__ }; \
@ -333,7 +333,7 @@ bool exchange_test_asserts_message(listener_t *this, ike_sa_t *ike_sa,
.listener = { .message = exchange_test_asserts_message, }, \ .listener = { .message = exchange_test_asserts_message, }, \
.file = __FILE__, \ .file = __FILE__, \
.line = __LINE__, \ .line = __LINE__, \
.incoming = streq(#dir, "IN") ? TRUE : FALSE, \ .incoming = streq(dir, "IN") ? TRUE : FALSE, \
.count = c, \ .count = c, \
.rules = _rules, \ .rules = _rules, \
.num_rules = countof(_rules), \ .num_rules = countof(_rules), \

View File

@ -549,10 +549,14 @@ END_TEST
#ifdef WIN32 #ifdef WIN32
# define include1 "C:\\Windows\\Temp\\strongswan-settings-test-include1" # define include1 "C:\\Windows\\Temp\\strongswan-settings-test-include1"
# define include1_str "C:\\\\Windows\\\\Temp\\\\strongswan-settings-test-include1"
# define include2 "C:\\Windows\\Temp\\strongswan-settings-test-include2" # define include2 "C:\\Windows\\Temp\\strongswan-settings-test-include2"
# define include2_str "C:\\\\Windows\\\\Temp\\\\strongswan-settings-test-include2"
#else #else
# define include1 "/tmp/strongswan-settings-test-include1" # define include1 "/tmp/strongswan-settings-test-include1"
# define include1_str include1
# define include2 "/tmp/strongswan-settings-test-include2" # define include2 "/tmp/strongswan-settings-test-include2"
# define include2_str include2
#endif #endif
static char *include_content1 = static char *include_content1 =
@ -638,10 +642,10 @@ START_TEST(test_include_string)
" include this/does/not/exist.conf\n" " include this/does/not/exist.conf\n"
" include = value\n" " include = value\n"
" key2 = value2\n" " key2 = value2\n"
" include \"" include2 "\"\n" " include \"" include2_str "\"\n"
" }\n" " }\n"
"}\n" "}\n"
"include \"" include1 "\""); "include \"" include1_str "\"");
create_settings(contents); create_settings(contents);
verify_include(); verify_include();

View File

@ -41,7 +41,7 @@ TEST_SUITE(auth_cfg_suite_create)
TEST_SUITE(hasher_suite_create) TEST_SUITE(hasher_suite_create)
TEST_SUITE(crypter_suite_create) TEST_SUITE(crypter_suite_create)
TEST_SUITE(crypto_factory_suite_create) TEST_SUITE(crypto_factory_suite_create)
TEST_SUITE(iv_gen_suite_create) TEST_SUITE_DEPEND(iv_gen_suite_create, RNG, RNG_STRONG)
TEST_SUITE(pen_suite_create) TEST_SUITE(pen_suite_create)
TEST_SUITE(asn1_suite_create) TEST_SUITE(asn1_suite_create)
TEST_SUITE(asn1_parser_suite_create) TEST_SUITE(asn1_parser_suite_create)