Disable tests of /proc/cpuinfo in LXC containers
It seems that we can't access /proc files when running inside such containers, so don't try to do it.
This commit is contained in:
@@ -154,7 +154,10 @@ TEST_CASE("wxFile::Special", "[file][linux][special-file]")
|
|||||||
|
|
||||||
wxString s;
|
wxString s;
|
||||||
CHECK( fileProc.ReadAll(&s) );
|
CHECK( fileProc.ReadAll(&s) );
|
||||||
CHECK( !s.empty() );
|
|
||||||
|
// /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
|
// All files in /sys have the size of one kernel page, even if they don't
|
||||||
// have that much data in them.
|
// have that much data in them.
|
||||||
|
@@ -69,6 +69,10 @@ std::string wxTheCurrentTestClass, wxTheCurrentTestMethod;
|
|||||||
#endif // __WXGTK__
|
#endif // __WXGTK__
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
#include "wx/filename.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "wx/socket.h"
|
#include "wx/socket.h"
|
||||||
#include "wx/evtloop.h"
|
#include "wx/evtloop.h"
|
||||||
|
|
||||||
@@ -418,6 +422,17 @@ extern bool IsRunningUnderXVFB()
|
|||||||
return s_isRunningUnderXVFB == 1;
|
return s_isRunningUnderXVFB == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __LINUX__
|
||||||
|
|
||||||
|
extern bool IsRunningInLXC()
|
||||||
|
{
|
||||||
|
// This is simplistic but should work in the normal cases and can always be
|
||||||
|
// made more precise later if necessary.
|
||||||
|
return wxFileName::DirExists("/dev/lxd");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __LINUX__
|
||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
|
||||||
bool EnableUITests()
|
bool EnableUITests()
|
||||||
|
@@ -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
|
||||||
{
|
{
|
||||||
|
@@ -348,7 +348,11 @@ TEST_CASE("wxTextFile::Special", "[textfile][linux][special-file]")
|
|||||||
{
|
{
|
||||||
wxTextFile f;
|
wxTextFile f;
|
||||||
CHECK( f.Open("/proc/cpuinfo") );
|
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")
|
||||||
|
Reference in New Issue
Block a user