diff --git a/.travis.yml b/.travis.yml index 62907a985a..67c5f41e6f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,42 +7,51 @@ sudo: required matrix: include: - - dist: precise - compiler: gcc - env: wxUSE_XVFB=1 - - dist: trusty - compiler: gcc - - dist: trusty - compiler: gcc - env: wxCONFIGURE_FLAGS="--enable-utf8 --enable-utf8only --enable-monolithic" wxUSE_XVFB=1 - - dist: trusty - compiler: gcc - env: wxGTK_VERSION=3 wxCONFIGURE_FLAGS="--enable-cxx11 --enable-stl --disable-webview" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" wxUSE_XVFB=1 - - dist: trusty - compiler: clang - env: wxCONFIGURE_FLAGS="--disable-shared --disable-sys-libs --disable-webview" wxUSE_XVFB=1 - - dist: trusty - compiler: gcc - env: wxTOOLSET=cmake wxCMAKE_GENERATOR="Unix Makefiles" - - os: osx - osx_image: xcode6.4 - compiler: clang - env: wxCONFIGURE_FLAGS="--enable-cxx11" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" wxSKIP_SAMPLES=1 - - os: osx - compiler: clang - env: wxTOOLSET=cmake wxCMAKE_GENERATOR=Xcode wxCMAKE_DEFINES="-DCMAKE_CXX_STANDARD=11" - - dist: trusty - compiler: gcc - env: wxCONFIGURE_FLAGS="--with-x11 --enable-pch --disable-stc" wxSKIP_SAMPLES=1 - - dist: trusty - compiler: gcc - env: wxCONFIGURE_FLAGS="--with-directfb --enable-pch --disable-stc" wxSKIP_SAMPLES=1 - - dist: trusty - compiler: gcc - env: wxCONFIGURE_FLAGS="--with-motif --enable-pch --disable-stc" wxSKIP_SAMPLES=1 - - dist: trusty - compiler: gcc - env: wxCONFIGURE_FLAGS="--with-qt --enable-pch" wxSKIP_SAMPLES=1 + - os: linux + arch: arm64 + env: wxCONFIGURE_FLAGS="--disable-sys-libs" wxLXC=1 + - os: linux + arch: ppc64le + env: wxCONFIGURE_FLAGS="--disable-sys-libs" wxLXC=1 + - os: linux + arch: s390x + env: wxCONFIGURE_FLAGS="--disable-sys-libs" wxLXC=1 +# - dist: precise +# compiler: gcc +# env: wxUSE_XVFB=1 +# - dist: trusty +# compiler: gcc +# - dist: trusty +# compiler: gcc +# env: wxCONFIGURE_FLAGS="--enable-utf8 --enable-utf8only --enable-monolithic" wxUSE_XVFB=1 +# - dist: trusty +# compiler: gcc +# env: wxGTK_VERSION=3 wxCONFIGURE_FLAGS="--enable-cxx11 --enable-stl --disable-webview" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" wxUSE_XVFB=1 +# - dist: trusty +# compiler: clang +# env: wxCONFIGURE_FLAGS="--disable-shared --disable-sys-libs --disable-webview" wxUSE_XVFB=1 +# - dist: trusty +# compiler: gcc +# env: wxTOOLSET=cmake wxCMAKE_GENERATOR="Unix Makefiles" +# - os: osx +# osx_image: xcode6.4 +# compiler: clang +# env: wxCONFIGURE_FLAGS="--enable-cxx11" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" wxSKIP_SAMPLES=1 +# - os: osx +# compiler: clang +# env: wxTOOLSET=cmake wxCMAKE_GENERATOR=Xcode wxCMAKE_DEFINES="-DCMAKE_CXX_STANDARD=11" +# - dist: trusty +# compiler: gcc +# env: wxCONFIGURE_FLAGS="--with-x11 --enable-pch --disable-stc" wxSKIP_SAMPLES=1 +# - dist: trusty +# compiler: gcc +# env: wxCONFIGURE_FLAGS="--with-directfb --enable-pch --disable-stc" wxSKIP_SAMPLES=1 +# - dist: trusty +# compiler: gcc +# env: wxCONFIGURE_FLAGS="--with-motif --enable-pch --disable-stc" wxSKIP_SAMPLES=1 +# - dist: trusty +# compiler: gcc +# env: wxCONFIGURE_FLAGS="--with-qt --enable-pch" wxSKIP_SAMPLES=1 branches: only: diff --git a/tests/file/filetest.cpp b/tests/file/filetest.cpp index f1876daf94..0f31b12db3 100644 --- a/tests/file/filetest.cpp +++ b/tests/file/filetest.cpp @@ -149,21 +149,26 @@ TEST_CASE("wxFile::Special", "[file][linux][special-file]") // for reading) and usually we don't have the permissions to do it. // This file is not seekable and has 0 size, but can still be read. - wxFile fileProc("/proc/diskstats"); + wxFile fileProc("/proc/cpuinfo"); CHECK( fileProc.IsOpened() ); wxString s; CHECK( fileProc.ReadAll(&s) ); - CHECK( !s.empty() ); - // All files in /sys seem to have size of 4KiB currently, even if they - // don't have that much data in them. + // /proc files seem to be always empty in LXC containers. + if ( !IsRunningInLXC() ) + CHECK( !s.empty() ); + + // All files in /sys have the size of one kernel page, even if they don't + // have that much data in them. + const long pageSize = sysconf(_SC_PAGESIZE); + wxFile fileSys("/sys/power/state"); - CHECK( fileSys.Length() == 4096 ); + CHECK( fileSys.Length() == pageSize ); CHECK( fileSys.IsOpened() ); CHECK( fileSys.ReadAll(&s) ); CHECK( !s.empty() ); - CHECK( s.length() < 4096 ); + CHECK( s.length() < pageSize ); } #endif // __LINUX__ diff --git a/tests/filename/filenametest.cpp b/tests/filename/filenametest.cpp index 240e95205c..1db0edc52d 100644 --- a/tests/filename/filenametest.cpp +++ b/tests/filename/filenametest.cpp @@ -1059,8 +1059,9 @@ TEST_CASE("wxFileName::GetSizeSpecial", "[filename][linux][special-file]") INFO( "size of /proc/kcore=" << size ); CHECK( size > 0 ); - // All files in /sys seem to have size of 4KiB currently. - CHECK( wxFileName::GetSize("/sys/power/state") == 4096 ); + // All files in /sys are one page in size, irrespectively of the size of + // their actual contents. + CHECK( wxFileName::GetSize("/sys/power/state") == sysconf(_SC_PAGESIZE) ); } #endif // __LINUX__ diff --git a/tests/test.cpp b/tests/test.cpp index 851785a72c..259c7c71db 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -422,6 +422,20 @@ extern bool IsRunningUnderXVFB() return s_isRunningUnderXVFB == 1; } +#ifdef __LINUX__ + +extern bool IsRunningInLXC() +{ + // We're supposed to be able to detect running in LXC by checking for + // /dev/lxd existency, but this doesn't work under Travis for some reason, + // so just rely on having the environment variable defined for the + // corresponding builds in our .travis.yml. + wxString value; + return wxGetEnv("wxLXC", &value) && value == "1"; +} + +#endif // __LINUX__ + #if wxUSE_GUI bool EnableUITests() diff --git a/tests/testprec.h b/tests/testprec.h index 7ae35168cc..38e2ce14e0 100644 --- a/tests/testprec.h +++ b/tests/testprec.h @@ -123,6 +123,10 @@ extern bool IsAutomaticTest(); extern bool IsRunningUnderXVFB(); +#ifdef __LINUX__ +extern bool IsRunningInLXC(); +#endif // __LINUX__ + // Helper class setting the locale to the given one for its lifetime. class LocaleSetter { diff --git a/tests/textfile/textfiletest.cpp b/tests/textfile/textfiletest.cpp index eda450d1f3..dc7d22423d 100644 --- a/tests/textfile/textfiletest.cpp +++ b/tests/textfile/textfiletest.cpp @@ -347,8 +347,12 @@ TEST_CASE("wxTextFile::Special", "[textfile][linux][special-file]") SECTION("/proc") { wxTextFile f; - CHECK( f.Open("/proc/diskstats") ); - CHECK( f.GetLineCount() > 1 ); + CHECK( f.Open("/proc/cpuinfo") ); + + // /proc files seem to be always empty in LXC containers, so skip this + // check there. + if ( !IsRunningInLXC() ) + CHECK( f.GetLineCount() > 1 ); } SECTION("/sys") @@ -357,7 +361,7 @@ TEST_CASE("wxTextFile::Special", "[textfile][linux][special-file]") CHECK( f.Open("/sys/power/state") ); REQUIRE( f.GetLineCount() == 1 ); INFO( "/sys/power/state contains \"" << f[0] << "\"" ); - CHECK( f[0].find("mem") != wxString::npos ); + CHECK( (f[0].find("mem") != wxString::npos || f[0].find("disk") != wxString::npos) ); } }