Merge branch 'more-travis'

Test Linux on ARM, PPC64 and S390 architectures on Travis CI too.

See https://github.com/wxWidgets/wxWidgets/pull/1783
This commit is contained in:
Vadim Zeitlin
2020-04-19 22:25:16 +02:00
6 changed files with 84 additions and 47 deletions

View File

@@ -7,42 +7,51 @@ sudo: required
matrix: matrix:
include: include:
- dist: precise - os: linux
compiler: gcc arch: arm64
env: wxUSE_XVFB=1 env: wxCONFIGURE_FLAGS="--disable-sys-libs" wxLXC=1
- dist: trusty - os: linux
compiler: gcc arch: ppc64le
- dist: trusty env: wxCONFIGURE_FLAGS="--disable-sys-libs" wxLXC=1
compiler: gcc - os: linux
env: wxCONFIGURE_FLAGS="--enable-utf8 --enable-utf8only --enable-monolithic" wxUSE_XVFB=1 arch: s390x
- dist: trusty env: wxCONFIGURE_FLAGS="--disable-sys-libs" wxLXC=1
compiler: gcc # - dist: precise
env: wxGTK_VERSION=3 wxCONFIGURE_FLAGS="--enable-cxx11 --enable-stl --disable-webview" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" wxUSE_XVFB=1 # compiler: gcc
- dist: trusty # env: wxUSE_XVFB=1
compiler: clang # - dist: trusty
env: wxCONFIGURE_FLAGS="--disable-shared --disable-sys-libs --disable-webview" wxUSE_XVFB=1 # compiler: gcc
- dist: trusty # - dist: trusty
compiler: gcc # compiler: gcc
env: wxTOOLSET=cmake wxCMAKE_GENERATOR="Unix Makefiles" # env: wxCONFIGURE_FLAGS="--enable-utf8 --enable-utf8only --enable-monolithic" wxUSE_XVFB=1
- os: osx # - dist: trusty
osx_image: xcode6.4 # compiler: gcc
compiler: clang # env: wxGTK_VERSION=3 wxCONFIGURE_FLAGS="--enable-cxx11 --enable-stl --disable-webview" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" wxUSE_XVFB=1
env: wxCONFIGURE_FLAGS="--enable-cxx11" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" wxSKIP_SAMPLES=1 # - dist: trusty
- os: osx # compiler: clang
compiler: clang # env: wxCONFIGURE_FLAGS="--disable-shared --disable-sys-libs --disable-webview" wxUSE_XVFB=1
env: wxTOOLSET=cmake wxCMAKE_GENERATOR=Xcode wxCMAKE_DEFINES="-DCMAKE_CXX_STANDARD=11" # - dist: trusty
- dist: trusty # compiler: gcc
compiler: gcc # env: wxTOOLSET=cmake wxCMAKE_GENERATOR="Unix Makefiles"
env: wxCONFIGURE_FLAGS="--with-x11 --enable-pch --disable-stc" wxSKIP_SAMPLES=1 # - os: osx
- dist: trusty # osx_image: xcode6.4
compiler: gcc # compiler: clang
env: wxCONFIGURE_FLAGS="--with-directfb --enable-pch --disable-stc" wxSKIP_SAMPLES=1 # env: wxCONFIGURE_FLAGS="--enable-cxx11" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" wxSKIP_SAMPLES=1
- dist: trusty # - os: osx
compiler: gcc # compiler: clang
env: wxCONFIGURE_FLAGS="--with-motif --enable-pch --disable-stc" wxSKIP_SAMPLES=1 # env: wxTOOLSET=cmake wxCMAKE_GENERATOR=Xcode wxCMAKE_DEFINES="-DCMAKE_CXX_STANDARD=11"
- dist: trusty # - dist: trusty
compiler: gcc # compiler: gcc
env: wxCONFIGURE_FLAGS="--with-qt --enable-pch" wxSKIP_SAMPLES=1 # 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: branches:
only: only:

View File

@@ -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. // 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. // 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() ); CHECK( fileProc.IsOpened() );
wxString s; wxString s;
CHECK( fileProc.ReadAll(&s) ); CHECK( fileProc.ReadAll(&s) );
CHECK( !s.empty() );
// All files in /sys seem to have size of 4KiB currently, even if they // /proc files seem to be always empty in LXC containers.
// don't have that much data in them. 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"); wxFile fileSys("/sys/power/state");
CHECK( fileSys.Length() == 4096 ); CHECK( fileSys.Length() == pageSize );
CHECK( fileSys.IsOpened() ); CHECK( fileSys.IsOpened() );
CHECK( fileSys.ReadAll(&s) ); CHECK( fileSys.ReadAll(&s) );
CHECK( !s.empty() ); CHECK( !s.empty() );
CHECK( s.length() < 4096 ); CHECK( s.length() < pageSize );
} }
#endif // __LINUX__ #endif // __LINUX__

View File

@@ -1059,8 +1059,9 @@ TEST_CASE("wxFileName::GetSizeSpecial", "[filename][linux][special-file]")
INFO( "size of /proc/kcore=" << size ); INFO( "size of /proc/kcore=" << size );
CHECK( size > 0 ); CHECK( size > 0 );
// All files in /sys seem to have size of 4KiB currently. // All files in /sys are one page in size, irrespectively of the size of
CHECK( wxFileName::GetSize("/sys/power/state") == 4096 ); // their actual contents.
CHECK( wxFileName::GetSize("/sys/power/state") == sysconf(_SC_PAGESIZE) );
} }
#endif // __LINUX__ #endif // __LINUX__

View File

@@ -422,6 +422,20 @@ extern bool IsRunningUnderXVFB()
return s_isRunningUnderXVFB == 1; 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 #if wxUSE_GUI
bool EnableUITests() bool EnableUITests()

View File

@@ -123,6 +123,10 @@ extern bool IsAutomaticTest();
extern bool IsRunningUnderXVFB(); extern bool IsRunningUnderXVFB();
#ifdef __LINUX__
extern bool IsRunningInLXC();
#endif // __LINUX__
// Helper class setting the locale to the given one for its lifetime. // Helper class setting the locale to the given one for its lifetime.
class LocaleSetter class LocaleSetter
{ {

View File

@@ -347,8 +347,12 @@ TEST_CASE("wxTextFile::Special", "[textfile][linux][special-file]")
SECTION("/proc") SECTION("/proc")
{ {
wxTextFile f; wxTextFile f;
CHECK( f.Open("/proc/diskstats") ); CHECK( f.Open("/proc/cpuinfo") );
CHECK( f.GetLineCount() > 1 );
// /proc files seem to be always empty in LXC containers, so skip this
// check there.
if ( !IsRunningInLXC() )
CHECK( f.GetLineCount() > 1 );
} }
SECTION("/sys") SECTION("/sys")
@@ -357,7 +361,7 @@ TEST_CASE("wxTextFile::Special", "[textfile][linux][special-file]")
CHECK( f.Open("/sys/power/state") ); CHECK( f.Open("/sys/power/state") );
REQUIRE( f.GetLineCount() == 1 ); REQUIRE( f.GetLineCount() == 1 );
INFO( "/sys/power/state contains \"" << f[0] << "\"" ); 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) );
} }
} }