summaryrefslogtreecommitdiff
path: root/sal/qa/osl/process/osl_process.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-02-22 21:13:06 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-02-22 21:13:06 +0000
commitd83d6212f93d792d0d024de1c20a75ff3e839955 (patch)
tree70371c5110f5d1757e8fa6ed3db01afd2a373905 /sal/qa/osl/process/osl_process.cxx
parent933acd0e9aa0565b23e615c314a8044148c32d5e (diff)
Account for the possibilty of a newline in an env variable
So, lets getline on '\0' and keep it simple.
Diffstat (limited to 'sal/qa/osl/process/osl_process.cxx')
-rw-r--r--sal/qa/osl/process/osl_process.cxx26
1 files changed, 9 insertions, 17 deletions
diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx
index 22f82e4cf..dc9a8e307 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -378,6 +378,7 @@ class Test_osl_executeProcess : public CppUnit::TestFixture
{
const OUString env_param_;
+ OUString temp_file_url_;
OUString temp_file_path_;
rtl_uString* parameters_[2];
int parameters_count_;
@@ -402,14 +403,18 @@ public:
//------------------------------------------------
virtual void setUp()
{
- temp_file_path_ = create_temp_file();
+ temp_file_path_ = create_temp_file(temp_file_url_);
parameters_[1] = temp_file_path_.pData;
}
+ virtual void tearDown()
+ {
+ osl::File::remove(temp_file_url_);
+ }
+
//------------------------------------------------
- OUString create_temp_file()
+ OUString create_temp_file(OUString &temp_file_url)
{
- OUString temp_file_url;
FileBase::RC rc = FileBase::createTempFile(0, 0, &temp_file_url);
CPPUNIT_ASSERT_MESSAGE("createTempFile failed", FileBase::E_None == rc);
@@ -434,20 +439,11 @@ public:
);
std::string line;
- while (std::getline(file, line))
+ while (std::getline(file, line, '\0'))
env_container->push_back(line);
}
//------------------------------------------------
- void dump_env(const string_container_t& env, OUString file_name)
- {
- OString fname = OUStringToOString(file_name, osl_getThreadTextEncoding());
- std::ofstream file(fname.getStr());
- std::ostream_iterator<std::string> oi(file, "\n");
- std::copy(env.begin(), env.end(), oi);
- }
-
- //------------------------------------------------
// environment of the child process that was
// started. The child process writes his
// environment into a file
@@ -677,9 +673,6 @@ public:
}
CPPUNIT_TEST_SUITE(Test_osl_executeProcess);
- //TODO: very odd, these pass locally for me, but fail on tinderbox,
- //disable until I can reproduce the failure
-#if 0
//TODO: Repair these under windows.
#ifndef WNT
CPPUNIT_TEST(osl_execProc_parent_equals_child_environment);
@@ -689,7 +682,6 @@ public:
// CPPUNIT_TEST(osl_execProc_test_batch);
///TODO: Repair test (or tested function ;-) - test fails.
// CPPUNIT_TEST(osl_execProc_exe_name_in_argument_list);
-#endif
CPPUNIT_TEST_SUITE_END();
};