diff --git a/.appveyor.yml b/.appveyor.yml index d83b8b57..663b8a9b 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -14,7 +14,7 @@ environment: install: - ps: Invoke-WebRequest $env:cygwin_url -OutFile c:\cygwin-setup.exe # libcrypt-devel is needed only on x86_64 and only for modperl... probably some dependency problem. - - c:\cygwin-setup.exe --quiet-mode --no-shortcuts --no-startmenu --no-desktop --upgrade-also --only-site --site http://mirrors.kernel.org/sourceware/cygwin/ --root c:\cygwin-root --local-package-dir c:\cygwin-setup-cache --packages automake,gcc-g++,make,pkg-config,wget,openssl-devel,libicu-devel,zlib-devel,libcrypt-devel,perl,python3,swig,libsasl2-devel + - c:\cygwin-setup.exe --quiet-mode --no-shortcuts --no-startmenu --no-desktop --upgrade-also --only-site --site http://mirrors.kernel.org/sourceware/cygwin/ --root c:\cygwin-root --local-package-dir c:\cygwin-setup-cache --packages automake,gcc-g++,make,pkg-config,wget,openssl-devel,libicu-devel,zlib-devel,libcrypt-devel,perl,python3,swig,libsasl2-devel,python3-setuptools,socat - c:\cygwin-root\bin\sh -lc "echo Hi" - c:\cygwin-root\bin\sh -lc "uname -a" - c:\cygwin-root\bin\sh -lc "cat /proc/cpuinfo" @@ -28,6 +28,7 @@ install: (New-Object Net.WebClient).DownloadFile('http://googletest.googlecode.com/files/gtest-1.7.0.zip', 'c:\gtest-1.7.0.zip') 7z x -oc:\ c:\gtest-1.7.0.zip } + - c:\cygwin-root\bin\sh -lc "/bin/easy_install* pexpect" # stdin is broken at AppVeyor, so we open it explicitly as /dev/null build_script: - git submodule update --init diff --git a/.travis.yml b/.travis.yml index 3b0106f1..2823ed72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,10 +42,11 @@ install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:teward/swig3.0; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:teward/icu-backports; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libperl-dev python3-dev tcl-dev libsasl2-dev libgtest-dev libicu-dev swig3.0 doxygen graphviz; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libperl-dev python3-dev tcl-dev libsasl2-dev libgtest-dev libicu-dev swig3.0 doxygen graphviz python3-setuptools socat; fi - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" == "g++" ]]; then sudo apt-get install g++-4.8; fi - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" == "g++" ]]; then export CXX="g++-4.8" CC="gcc-4.8"; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CFGFLAGS="$CFGFLAGS --with-gtest=/usr/src/gtest"; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo easy_install3 pexpect; fi - | if [[ "$TRAVIS_OS_NAME" == "linux" && "$BUILD_TYPE" == "coverage" ]]; then # when travis upgrades ubuntu, install lcov from apt-get instead @@ -62,8 +63,9 @@ install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew config; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list --versions; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install swig python3 icu4c jq openssl; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install swig python3 icu4c jq openssl socat; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew info --json=v1 --installed | jq .; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip3 install pexpect; fi - "echo pkg-config path: [$PKG_CONFIG_PATH]" script: - ./bootstrap.sh diff --git a/Makefile.in b/Makefile.in index 98988e0a..909493c9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -224,11 +224,8 @@ test: unittest $(Q)./unittest test2: - # The following is only for coverage to see that we also have modules, which (theoretically) should be tested too. - # It exploits the fact that ZNC opens every module on startup to check whether it was installed properly or not. - # This should be replaced by a better integration test at some point. - # Also it uses files at /lib/znc, which is less than ideal, especially from build scripts of distros. + # This test uses files at /lib/znc, which is less than ideal, especially from build scripts of distros. # That's why it's a separate make target. - $(Q)./znc --makeconf --datadir $(shell pwd)/empty-dir-for-test < /dev/null || true + $(Q)$(srcdir)/test/makeconf.py -include $(wildcard .depend/*.dep) diff --git a/test/makeconf.py b/test/makeconf.py new file mode 100755 index 00000000..f2535f5a --- /dev/null +++ b/test/makeconf.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2004-2015 ZNC, see the NOTICE file for details. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +import pexpect +import sys +import tempfile + +with tempfile.TemporaryDirectory() as config_dir: + znc = pexpect.spawnu('./znc', ['--debug', '--datadir', config_dir, '--makeconf']) + znc.logfile_read = sys.stdout + znc.expect_exact('Listen on port'); znc.sendline('12345') + znc.expect_exact('Listen using SSL'); znc.sendline() + znc.expect_exact('IPv6'); znc.sendline() + znc.expect_exact('Username'); znc.sendline('user') + znc.expect_exact('password'); znc.sendline('hunter2') + znc.expect_exact('Confirm'); znc.sendline('hunter2') + znc.expect_exact('Nick [user]'); znc.sendline() + znc.expect_exact('Alternate nick [user_]'); znc.sendline() + znc.expect_exact('Ident [user]'); znc.sendline() + znc.expect_exact('Real name'); znc.sendline() + znc.expect_exact('Bind host'); znc.sendline() + znc.expect_exact('Set up a network?'); znc.sendline() + znc.expect_exact('Name [freenode]'); znc.sendline('test') + znc.expect_exact('Server host (host only)'); znc.sendline('localhost') + znc.expect_exact('Server uses SSL?'); znc.sendline() + znc.expect_exact('6667'); znc.sendline() + znc.expect_exact('password'); znc.sendline() + znc.expect_exact('channels'); znc.sendline() + znc.expect_exact('Launch ZNC now?'); znc.sendline('no') + znc.expect_exact(pexpect.EOF)