mirror of https://github.com/KLayout/klayout.git
Merge remote-tracking branch 'origin/pymod' into pymod
This commit is contained in:
commit
7df9242efb
|
|
@ -30,10 +30,25 @@ TEST(1)
|
||||||
std::string fp (tl::testsrc ());
|
std::string fp (tl::testsrc ());
|
||||||
fp += "/testdata/bd/strmrun.py";
|
fp += "/testdata/bd/strmrun.py";
|
||||||
|
|
||||||
std::string path = tl::combine_path (tl::get_inst_path (), "strmrun ") + fp;
|
std::string cmd;
|
||||||
tl::InputPipe pipe (path);
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
// NOTE: because of system integrity, MacOS does not inherit DYLD_LIBRARY_PATH to child
|
||||||
|
// processes like sh. We need to port this variable explicitly.
|
||||||
|
const char *ldpath_name = "DYLD_LIBRARY_PATH";
|
||||||
|
const char *ldpath = getenv (ldpath_name);
|
||||||
|
if (ldpath) {
|
||||||
|
cmd += std::string (ldpath_name) + "=\"" + ldpath + "\"; export " + ldpath_name + "; ";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cmd += tl::combine_path (tl::get_inst_path (), "strmrun ") + fp;
|
||||||
|
tl::info << cmd;
|
||||||
|
|
||||||
|
tl::InputPipe pipe (cmd);
|
||||||
tl::InputStream is (pipe);
|
tl::InputStream is (pipe);
|
||||||
std::string data = is.read_all ();
|
std::string data = is.read_all ();
|
||||||
|
tl::info << data;
|
||||||
|
|
||||||
EXPECT_EQ (data, "Hello, world (0,-42;42,0)!\n");
|
EXPECT_EQ (data, "Hello, world (0,-42;42,0)!\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,20 @@ int run_pymodtest (tl::TestBase *_this, const std::string &fn)
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
{
|
{
|
||||||
std::string cmd = std::string ("\"") + STRINGIFY (PYTHON) + "\" " + fp + " 2>&1";
|
std::string cmd;
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
// NOTE: because of system integrity, MacOS does not inherit DYLD_LIBRARY_PATH to child
|
||||||
|
// processes like sh. We need to port this variable explicitly.
|
||||||
|
const char *ldpath_name = "DYLD_LIBRARY_PATH";
|
||||||
|
const char *ldpath = getenv (ldpath_name);
|
||||||
|
if (ldpath) {
|
||||||
|
cmd += std::string (ldpath_name) + "=\"" + ldpath + "\"; export " + ldpath_name + "; ";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cmd += std::string ("\"") + STRINGIFY (PYTHON) + "\" " + fp + " 2>&1";
|
||||||
|
|
||||||
tl::info << cmd;
|
tl::info << cmd;
|
||||||
tl::InputPipe pipe (cmd);
|
tl::InputPipe pipe (cmd);
|
||||||
tl::InputStream is (pipe);
|
tl::InputStream is (pipe);
|
||||||
|
|
|
||||||
|
|
@ -967,7 +967,8 @@ void
|
||||||
InputPipe::close ()
|
InputPipe::close ()
|
||||||
{
|
{
|
||||||
if (m_file != NULL) {
|
if (m_file != NULL) {
|
||||||
fclose (m_file);
|
pclose (m_file);
|
||||||
|
// TODO: pclose delivers the exit code - we should indicate it as return value of close.
|
||||||
m_file = NULL;
|
m_file = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,25 @@ load("test_prologue.rb")
|
||||||
|
|
||||||
class KLayoutMain_TestClass < TestBase
|
class KLayoutMain_TestClass < TestBase
|
||||||
|
|
||||||
|
def setup
|
||||||
|
@klayout_home_name = "KLAYOUT_HOME"
|
||||||
|
@klayout_home = ENV[@klayout_home_name]
|
||||||
|
# setting "KLAYOUT_HOME" to empty means we don't search any place
|
||||||
|
# for macros
|
||||||
|
ENV[@klayout_home_name] = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
ENV[@klayout_home_name] = @klayout_home
|
||||||
|
end
|
||||||
|
|
||||||
def klayout_bin
|
def klayout_bin
|
||||||
File.join(RBA::Application::instance.inst_path, "klayout")
|
# special location for MacOS
|
||||||
|
file = File.join(RBA::Application::instance.inst_path, "klayout.app", "Contents", "MacOS", "klayout")
|
||||||
|
if !File.exists?(file)
|
||||||
|
file = File.join(RBA::Application::instance.inst_path, "klayout")
|
||||||
|
end
|
||||||
|
return file
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_1
|
def test_1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue