diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..a0742c16 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,42 @@ +name: Tests + +on: + push: + branches: + - "*" + pull_request: + branches: + - "*" + +jobs: + tests-linux-i386: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - name: Run tests linux-i386 + run: | + scripts/tests-ubuntu-i386.sh + + tests-linux-amd64: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - name: Run tests linux-amd64 + run: | + scripts/tests-ubuntu-amd64.sh + + tests-windows-i386: + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v2 + - name: Run tests windows-i386 + run: | + git submodule init && git submodule update + ./waf.bat configure -T release --tests --prefix=out/ + ./waf.bat install + cd out + $env:Path = "bin"; + ./unittest.exe diff --git a/scripts/tests-ubuntu-amd64.sh b/scripts/tests-ubuntu-amd64.sh new file mode 100755 index 00000000..4cea4873 --- /dev/null +++ b/scripts/tests-ubuntu-amd64.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +git submodule init && git submodule update +sudo apt-get update +sudo apt-get install -f -y gdb libopenal-dev g++-multilib gcc-multilib libpng-dev libjpeg-dev libfreetype6-dev libfontconfig1-dev libcurl4-gnutls-dev libsdl2-dev zlib1g-dev libbz2-dev libedit-dev + +./waf configure -T release --disable-warns --tests --prefix=out/ --64bits $* && +./waf install && +cd out && +LD_LIBRARY_PATH=. ./unittest diff --git a/scripts/tests-ubuntu-i386.sh b/scripts/tests-ubuntu-i386.sh new file mode 100755 index 00000000..9edecaba --- /dev/null +++ b/scripts/tests-ubuntu-i386.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +git submodule init && git submodule update +sudo dpkg --add-architecture i386 +sudo apt-get update +sudo apt-get install -f -y libopenal-dev:i386 g++-multilib gcc-multilib libpng-dev:i386 libjpeg-dev:i386 libfreetype6-dev:i386 libfontconfig1-dev:i386 libcurl4-gnutls-dev:i386 libsdl2-dev:i386 zlib1g-dev:i386 libbz2-dev:i386 libedit-dev:i386 + +PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T release --disable-warns --tests --prefix=out/ $* && +./waf install && +cd out && +LD_LIBRARY_PATH=. ./unittest diff --git a/unitlib/wscript b/unitlib/wscript new file mode 100755 index 00000000..10924505 --- /dev/null +++ b/unitlib/wscript @@ -0,0 +1,44 @@ +#! /usr/bin/env python +# encoding: utf-8 + +from waflib import Utils +import os + +top = '.' +PROJECT_NAME = 'unitlib' + +def options(opt): + # stub + return + +def configure(conf): + conf.env.append_unique('DEFINES', ['UNITLIB_DLL_EXPORT=1']) + +def build(bld): + source = [ + 'unitlib.cpp' + ] + + includes = [ + '.', + '../', + '../public', + '../public/tier1', + '../public/tier0', + '../common' + ] + + defines = [] + libs = [] + + bld.shlib( + source = source, + target = PROJECT_NAME, + name = PROJECT_NAME, + features = 'c cxx', + includes = includes, + defines = defines, + use = libs, + subsystem = bld.env.MSVC_SUBSYSTEM, + idx = bld.get_taskgen_count() + ) diff --git a/utils/unittest/unittest.cpp b/utils/unittest/unittest.cpp index a3de234b..9135c67c 100644 --- a/utils/unittest/unittest.cpp +++ b/utils/unittest/unittest.cpp @@ -40,6 +40,7 @@ SpewRetval_t UnitTestSpew( SpewType_t type, char const *pMsg ) break; } printf( "%s", pMsg ); + fflush(stdout); if ( Sys_IsDebuggerPresent() ) return ( type == SPEW_ASSERT || type == SPEW_ERROR ) ? SPEW_DEBUGGER : SPEW_CONTINUE; diff --git a/utils/unittest/wscript b/utils/unittest/wscript index 24d4c3c1..14143def 100755 --- a/utils/unittest/wscript +++ b/utils/unittest/wscript @@ -23,6 +23,7 @@ def build(bld): if bld.env.DEST_OS != 'win32': libs += [ 'DL', 'LOG' ] else: + bld.env.LDFLAGS += ['/subsystem:console'] libs += ['USER32', 'SHELL32'] install_path = bld.env.BINDIR