diff options
author | Andreas Weigel <andreaswe@securepoint.de> | 2017-02-23 11:55:49 +0100 |
---|---|---|
committer | Christian Beier <dontmind@freeshell.org> | 2017-05-14 20:38:57 +0200 |
commit | 8fefdcde2750340c8c4062548e51acc34ae61496 (patch) | |
tree | 5d3cdef27016a701d35fdc3d18545d0cd4ed41fe /test | |
parent | a90a43cda546f6f4304623ebd5e6dd9cdb87fc16 (diff) | |
download | libtdevnc-8fefdcde2750340c8c4062548e51acc34ae61496.tar.gz libtdevnc-8fefdcde2750340c8c4062548e51acc34ae61496.zip |
fix problems in test and requests for cmake build
add missing stdarg header
fix hardcoded errno integer values in tests
add dependency to wstestdata and rename to prevent building it as c
source
Diffstat (limited to 'test')
-rwxr-xr-x | test/wsmaketestframe.py | 11 | ||||
-rw-r--r-- | test/wstest.c | 3 | ||||
-rw-r--r-- | test/wstestdata.inc (renamed from test/wstestdata.c) | 10 |
3 files changed, 12 insertions, 12 deletions
diff --git a/test/wsmaketestframe.py b/test/wsmaketestframe.py index 3412754..1d4d24d 100755 --- a/test/wsmaketestframe.py +++ b/test/wsmaketestframe.py @@ -24,7 +24,6 @@ import websockets import base64 -import errno ''' Create websocket frames for the wstest websocket decoding unit test. @@ -105,13 +104,13 @@ flist.append(Testframe(websockets.framing.Frame(1, 2, bytearray("Frame2 does con #flist.append(Testframe(websockets.framing.Frame(1, 2, bytearray([(x % 26) + 65 for x in range(100000)])), "100k binary frame (ABC..YZABC..)")) ### some conn reset frames, one with no close message, one with close message -flist.append(Testframe(websockets.framing.Frame(1, 8, bytearray(list([0x03, 0xEB]))), "Close frame (Reason 1003)", experrno=errno.ECONNRESET)) -flist.append(Testframe(websockets.framing.Frame(1, 8, bytearray(list([0x03, 0xEB])) + bytearray("I'm a close reason and much more than that!", encoding="utf-8")), "Close frame (Reason 1003) and msg", experrno=errno.ECONNRESET)) +flist.append(Testframe(websockets.framing.Frame(1, 8, bytearray(list([0x03, 0xEB]))), "Close frame (Reason 1003)", experrno="ECONNRESET")) +flist.append(Testframe(websockets.framing.Frame(1, 8, bytearray(list([0x03, 0xEB])) + bytearray("I'm a close reason and much more than that!", encoding="utf-8")), "Close frame (Reason 1003) and msg", experrno="ECONNRESET")) ### invalid header values -flist.append(Testframe(websockets.framing.Frame(1, 1, bytearray("Testit", encoding="utf-8")), "Invalid frame: Wrong masking", experrno=errno.EPROTO, mask=False)) -flist.append(Testframe(websockets.framing.Frame(1, 1, bytearray("..Lore Ipsum", encoding="utf-8")), "Invalid frame: Length of < 126 with add. 16 bit len field", experrno=errno.EPROTO, modify_bytes={ 1: 0xFE, 2: 0x00, 3: 0x0F})) -flist.append(Testframe(websockets.framing.Frame(1, 1, bytearray("........Lore Ipsum", encoding="utf-8")), "Invalid frame: Length of < 126 with add. 64 bit len field", experrno=errno.EPROTO, modify_bytes={ 1: 0xFF, 2: 0x00, 3: 0x00, 4: 0x00, 5: 0x00, 6: 0x80, 7: 0x40})) +flist.append(Testframe(websockets.framing.Frame(1, 1, bytearray("Testit", encoding="utf-8")), "Invalid frame: Wrong masking", experrno="EPROTO", mask=False)) +flist.append(Testframe(websockets.framing.Frame(1, 1, bytearray("..Lore Ipsum", encoding="utf-8")), "Invalid frame: Length of < 126 with add. 16 bit len field", experrno="EPROTO", modify_bytes={ 1: 0xFE, 2: 0x00, 3: 0x0F})) +flist.append(Testframe(websockets.framing.Frame(1, 1, bytearray("........Lore Ipsum", encoding="utf-8")), "Invalid frame: Length of < 126 with add. 64 bit len field", experrno="EPROTO", modify_bytes={ 1: 0xFF, 2: 0x00, 3: 0x00, 4: 0x00, 5: 0x00, 6: 0x80, 7: 0x40})) s = "struct ws_frame_test tests[] = {\n" for i in range(len(flist)): diff --git a/test/wstest.c b/test/wstest.c index 4a5ba91..69cd174 100644 --- a/test/wstest.c +++ b/test/wstest.c @@ -29,6 +29,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <stdarg.h> #include <unistd.h> #include <errno.h> @@ -70,7 +71,7 @@ struct ws_frame_test { int close_sock_at; }; -#include "wstestdata.c" +#include "wstestdata.inc" char el_log[1000000]; char *el_pos; diff --git a/test/wstestdata.c b/test/wstestdata.inc index 628bdb1..9dc919e 100644 --- a/test/wstestdata.c +++ b/test/wstestdata.inc @@ -52,7 +52,7 @@ struct ws_frame_test tests[] = { .expectedDecodeBuf={0X03,0XEB}, .frame_len=8, .raw_payload_len=2, - .expected_errno=104, + .expected_errno=ECONNRESET, .descr="Close frame (Reason 1003)", .i=0, .simulate_sock_malfunction_at=0, @@ -64,7 +64,7 @@ struct ws_frame_test tests[] = { .expectedDecodeBuf={0X03,0XEB,0X49,0X27,0X6D,0X20,0X61,0X20,0X63,0X6C,0X6F,0X73,0X65,0X20,0X72,0X65,0X61,0X73,0X6F,0X6E,0X20,0X61,0X6E,0X64,0X20,0X6D,0X75,0X63,0X68,0X20,0X6D,0X6F,0X72,0X65,0X20,0X74,0X68,0X61,0X6E,0X20,0X74,0X68,0X61,0X74,0X21}, .frame_len=51, .raw_payload_len=45, - .expected_errno=104, + .expected_errno=ECONNRESET, .descr="Close frame (Reason 1003) and msg", .i=0, .simulate_sock_malfunction_at=0, @@ -76,7 +76,7 @@ struct ws_frame_test tests[] = { .expectedDecodeBuf={0X54,0X65,0X73,0X74,0X69,0X74}, .frame_len=10, .raw_payload_len=6, - .expected_errno=71, + .expected_errno=EPROTO, .descr="Invalid frame: Wrong masking", .i=0, .simulate_sock_malfunction_at=0, @@ -88,7 +88,7 @@ struct ws_frame_test tests[] = { .expectedDecodeBuf={0X2E,0XFE,0X00,0X0F,0X72,0X65,0X20,0X49,0X70,0X73,0X75,0X6D}, .frame_len=22, .raw_payload_len=12, - .expected_errno=71, + .expected_errno=EPROTO, .descr="Invalid frame: Length of < 126 with add. 16 bit len field", .i=0, .simulate_sock_malfunction_at=0, @@ -100,7 +100,7 @@ struct ws_frame_test tests[] = { .expectedDecodeBuf={0X2E,0XFF,0X00,0X00,0X00,0X00,0X80,0X40,0X4C,0X6F,0X72,0X65,0X20,0X49,0X70,0X73,0X75,0X6D}, .frame_len=30, .raw_payload_len=18, - .expected_errno=71, + .expected_errno=EPROTO, .descr="Invalid frame: Length of < 126 with add. 64 bit len field", .i=0, .simulate_sock_malfunction_at=0, |