diff --git cpp.orig/allTests.py cpp/allTests.py index 33b7d88..8a5effd 100755 --- cpp.orig/allTests.py +++ cpp/allTests.py @@ -25,6 +25,7 @@ from scripts import * # List of all basic tests. # tests = [ + ("IceUtil/condvar", ["once", "win32only"]), ("IceUtil/thread", ["once"]), ("IceUtil/unicode", ["once"]), @@ -62,7 +63,7 @@ tests = [ ("Ice/servantLocator", ["core"]), ("Ice/interceptor", ["core"]), ("Ice/stringConverter", ["core"]), - ("Ice/udp", ["core"]), + ("Ice/udp", ["core", "nofreebsdjail"]), ("Ice/defaultServant", ["core"]), ("Ice/defaultValue", ["core"]), ("Ice/invoke", ["core", "novc6"]), @@ -106,8 +107,8 @@ tests = [ # if TestUtil.isWin32() or os.getuid() == 0: tests += [ - ("IceUtil/priority", ["core", "nodarwin"]), - ("Ice/threadPoolPriority", ["core", "nodarwin"]) + ("IceUtil/priority", ["core", "nodarwin", "nofreebsd"]), + ("Ice/threadPoolPriority", ["core", "nodarwin", "nofreebsd"]) ] if __name__ == "__main__": diff --git cpp.orig/test/Glacier2/ssl/Server.cpp cpp/test/Glacier2/ssl/Server.cpp index 4fb14f5..1b0c6a5 100644 --- cpp.orig/test/Glacier2/ssl/Server.cpp +++ cpp/test/Glacier2/ssl/Server.cpp @@ -31,9 +31,15 @@ void testContext(bool ssl, const Ice::Context& context) test(ctx["_con.type"] == "ssl"); test(ctx["_con.localPort"] == "12348"); } - test(ctx["_con.localAddress"] == "127.0.0.1"); + if (!inFreeBSDJail()) + { + test(ctx["_con.localAddress"] == "127.0.0.1"); + } test(ctx["_con.remotePort"] != ""); - test(ctx["_con.remoteAddress"] == "127.0.0.1"); + if (!inFreeBSDJail()) + { + test(ctx["_con.remoteAddress"] == "127.0.0.1"); + } } } @@ -99,7 +105,7 @@ public: } virtual void - ice_ping(const Ice::Current& current) + ice_ping(const Ice::Current& current) const { testContext(_ssl, current.ctx); } @@ -133,8 +139,11 @@ public: { testContext(true, current.ctx); - test(info.remoteHost == "127.0.0.1"); - test(info.localHost == "127.0.0.1"); + if (!inFreeBSDJail()) + { + test(info.remoteHost == "127.0.0.1"); + test(info.localHost == "127.0.0.1"); + } test(info.localPort == 12348); try diff --git cpp.orig/test/Ice/custom/AllTests.cpp cpp/test/Ice/custom/AllTests.cpp index bf66fa9..9907e6b 100644 --- cpp.orig/test/Ice/custom/AllTests.cpp +++ cpp/test/Ice/custom/AllTests.cpp @@ -1384,7 +1384,8 @@ public: const ::Test::ClassStructSeq& seq, const InParamPtr& cookie) { - pair< ::Test::ClassStructPtr, ::Test::ClassStructSeq> in = getIn(in, cookie); + pair< ::Test::ClassStructPtr, ::Test::ClassStructSeq> in; + in = getIn(in, cookie); test(ret == in.first); test(cs1 == in.first); test(seq == in.second); @@ -1432,7 +1433,8 @@ public: void throwExcept1(const Ice::AsyncResultPtr& result) { - wstring in = getIn(in, InParamPtr::dynamicCast(result->getCookie())); + wstring in; + in = getIn(in, InParamPtr::dynamicCast(result->getCookie())); try { Test1::WstringClassPrx t = Test1::WstringClassPrx::uncheckedCast(result->getProxy()); @@ -1451,7 +1453,8 @@ public: void throwExcept2(const Ice::AsyncResultPtr& result) { - wstring in = getIn(in, InParamPtr::dynamicCast(result->getCookie())); + wstring in; + in = getIn(in, InParamPtr::dynamicCast(result->getCookie())); try { Test2::WstringClassPrx t = Test2::WstringClassPrx::uncheckedCast(result->getProxy()); diff --git cpp.orig/test/Ice/info/AllTests.cpp cpp/test/Ice/info/AllTests.cpp index 3e9c229..7f92b7f 100644 --- cpp.orig/test/Ice/info/AllTests.cpp +++ cpp/test/Ice/info/AllTests.cpp @@ -141,9 +141,11 @@ allTests(const Ice::CommunicatorPtr& communicator) test(info->adapterName.empty()); test(info->localPort > 0); test(info->remotePort == 12010); - test(info->remoteAddress == defaultHost); - test(info->localAddress == defaultHost); - + if (!inFreeBSDJail()) + { + test(info->remoteAddress == defaultHost); + test(info->localAddress == defaultHost); + } ostringstream os; Ice::Context ctx = testIntf->getConnectionInfoAsContext(); @@ -163,8 +165,11 @@ allTests(const Ice::CommunicatorPtr& communicator) test(info->adapterName.empty()); test(info->localPort > 0); test(info->remotePort == 12010); - test(info->remoteAddress ==defaultHost); - test(info->localAddress == defaultHost); + if (!inFreeBSDJail()) + { + test(info->remoteAddress == defaultHost); + test(info->localAddress == defaultHost); + } } cout << "ok" << endl; diff --git cpp.orig/test/Ice/properties/run.py cpp/test/Ice/properties/run.py index 18f78f0..955295e 100755 --- cpp.orig/test/Ice/properties/run.py +++ cpp/test/Ice/properties/run.py @@ -26,7 +26,7 @@ client = os.path.join(os.getcwd(), "client") # # Write config # -configPath = u"./config/中国_client.config" +configPath = u"./config/中国_client.config".encode("utf-8") TestUtil.createConfig(configPath, ["# Automatically generated by Ice test driver.", diff --git cpp.orig/test/include/TestCommon.h cpp/test/include/TestCommon.h index 651a885..ca603d4 100644 --- cpp.orig/test/include/TestCommon.h +++ cpp/test/include/TestCommon.h @@ -17,6 +17,22 @@ #include #endif +#if defined(__FreeBSD__) +# include +# include +inline bool inFreeBSDJail() +{ + int jailed; + size_t size = sizeof(jailed); + return (sysctlbyname("security.jail.jailed", &jailed, &size, NULL, 0) != -1 || jailed); +} +#else +inline bool inFreeBSDJail() +{ + return false; +} +#endif + void inline testFailed(const char* expr, const char* file, unsigned int line) { diff --git scripts/TestUtil.py scripts/TestUtil.py index e02da06..9b5f497 100755 --- scripts/TestUtil.py +++ scripts/TestUtil.py @@ -74,6 +74,25 @@ def isDarwin(): def isLinux(): return sys.platform.startswith("linux") +def isFreeBSD(): + return sys.platform.startswith("freebsd") + +def sysctl(key): + p = subprocess.Popen("sysctl "+key, shell=1, stdout=subprocess.PIPE) + try: + result = p.communicate()[0].strip().split()[1] + except IndexError: + return 0 + if sys.version_info >= (3,): + result = str(result, sys.stdout.encoding) + try: + return int(result) + except ValueError: + return result + +def isFreeBSDJail(): + return isFreeBSD() and sysctl("security.jail.jailed") + def getCppCompiler(): compiler = "" if os.environ.get("CPP_COMPILER", "") != "": @@ -1590,7 +1609,15 @@ def runTests(start, expanded, num = 0, script = False): if isDarwin() and "nodarwin" in config: print "%s*** test not supported under Darwin%s" % (prefix, suffix) continue + + if isFreeBSD() and "nofreebsd" in config: + print "%s*** test not supported under FreeBSD%s" % (prefix, suffix) + continue + if isFreeBSDJail() and "nofreebsdjail" in config: + print "%s*** test not supported within a FreeBSD Jail%s" % (prefix, suffix) + continue + if not isWin32() and "win32only" in config: print "%s*** test only supported under Win32%s" % (prefix, suffix) continue