From 973a3f03c34fe1f1ddaa288e44d3426428ec4494 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Tue, 1 Jan 2019 17:13:26 -0800 Subject: [PATCH] linux fix + unittest works with Linux --- docker/Dockerfile.debian | 5 ++--- ixwebsocket/IXWebSocketServer.cpp | 1 + makefile | 2 +- test/build_linux.sh | 30 ++++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 test/build_linux.sh diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian index e9e5a1f3..a2d28e55 100644 --- a/docker/Dockerfile.debian +++ b/docker/Dockerfile.debian @@ -15,6 +15,5 @@ RUN apt-get -y install cmake COPY . . -#WORKDIR examples/ws_connect -#RUN ["sh", "build_linux.sh"] -RUN ["make", "test"] +WORKDIR test +RUN ["sh", "build_linux.sh"] diff --git a/ixwebsocket/IXWebSocketServer.cpp b/ixwebsocket/IXWebSocketServer.cpp index 3778f09e..68fcd0ff 100644 --- a/ixwebsocket/IXWebSocketServer.cpp +++ b/ixwebsocket/IXWebSocketServer.cpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace ix { diff --git a/makefile b/makefile index 295cb5ae..5be1fed7 100644 --- a/makefile +++ b/makefile @@ -21,6 +21,6 @@ build: test_server: (cd test && npm i ws && node broadcast-server.js) test: - (cd test && cmake . && make && ./ixwebsocket_unittest) + (cd test && sh run.sh) .PHONY: test diff --git a/test/build_linux.sh b/test/build_linux.sh new file mode 100644 index 00000000..c8d9f4e5 --- /dev/null +++ b/test/build_linux.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Author: Benjamin Sergeant +# Copyright (c) 2017-2018 Machine Zone, Inc. All rights reserved. +# + +# 'manual' way of building. You can also use cmake. + +g++ --std=c++11 \ + -DIXWEBSOCKET_USE_TLS \ + -g \ + ../ixwebsocket/IXEventFd.cpp \ + ../ixwebsocket/IXSocket.cpp \ + ../ixwebsocket/IXSetThreadName.cpp \ + ../ixwebsocket/IXWebSocketTransport.cpp \ + ../ixwebsocket/IXWebSocket.cpp \ + ../ixwebsocket/IXWebSocketServer.cpp \ + ../ixwebsocket/IXDNSLookup.cpp \ + ../ixwebsocket/IXSocketConnect.cpp \ + ../ixwebsocket/IXSocketOpenSSL.cpp \ + ../ixwebsocket/IXWebSocketPerMessageDeflate.cpp \ + ../ixwebsocket/IXWebSocketPerMessageDeflateOptions.cpp \ + -I ../.. \ + -I Catch2/single_include \ + test_runner.cpp \ + cmd_websocket_chat.cpp \ + IXTest.cpp \ + msgpack11.cpp \ + -o ixwebsocket_unittest \ + -lcrypto -lssl -lz -lpthread