summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2011-12-21 20:42:11 -0500
committerNat Goodspeed <nat@lindenlab.com>2011-12-21 20:42:11 -0500
commit25ef0cd2236aeb2d0047881e11a0022c4355cd48 (patch)
tree81f4c934452e7ea877a7d3491ceac8d53d498c70 /indra/llcommon
parent2fd0bc8648e71aa2f141fde4b3a6a0165f7ef4d6 (diff)
Tweak llprocesslauncher_test.cpp to run properly on Windows.
Fix EOL issues: "\r\n" vs. "\n". On Windows, requesting a read in nonblocking mode can produce EAGAIN instead of EWOULDBLOCK.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/tests/llprocesslauncher_test.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/indra/llcommon/tests/llprocesslauncher_test.cpp b/indra/llcommon/tests/llprocesslauncher_test.cpp
index ca06b3164e..bdae81770f 100644
--- a/indra/llcommon/tests/llprocesslauncher_test.cpp
+++ b/indra/llcommon/tests/llprocesslauncher_test.cpp
@@ -27,6 +27,9 @@
#if defined(LL_WINDOWS)
#define sleep _sleep
+#define EOL "\r\n"
+#else
+#define EOL "\n"
#endif
class APR
@@ -99,15 +102,15 @@ namespace tut
// Write it.
const char script[] =
- "import sys\n"
- "import time\n"
- "\n"
- "time.sleep(2)\n"
- "print >>sys.stdout, \"stdout after wait\"\n"
- "sys.stdout.flush()\n"
- "time.sleep(2)\n"
- "print >>sys.stderr, \"stderr after wait\"\n"
- "sys.stderr.flush()\n"
+ "import sys" EOL
+ "import time" EOL
+ EOL
+ "time.sleep(2)" EOL
+ "print >>sys.stdout, \"stdout after wait\"" EOL
+ "sys.stdout.flush()" EOL
+ "time.sleep(2)" EOL
+ "print >>sys.stderr, \"stderr after wait\"" EOL
+ "sys.stderr.flush()" EOL
;
apr_size_t len(sizeof(script)-1);
aprchk(apr_file_write(fp, script, &len));
@@ -159,7 +162,7 @@ namespace tut
outfiles.erase(outfiles.begin() + i);
continue;
}
- if (rv == EWOULDBLOCK)
+ if (rv == EWOULDBLOCK || rv == EAGAIN)
{
// std::cout << "(waiting; apr_file_gets(" << iterfiles[i].first << ") => " << rv << ": " << apr.strerror(rv) << ")\n";
++history.back().tries;
@@ -210,12 +213,12 @@ namespace tut
// waiting, proving the non-blocking nature of these pipes.
ensure("blocking I/O on child pipe (0)", history[0].tries);
ensure_equals(history[0].which, "out");
- ensure_equals(history[0].what, "stdout after wait\n");
+ ensure_equals(history[0].what, "stdout after wait" EOL);
ensure("blocking I/O on child pipe (1)", history[1].tries);
ensure_equals(history[1].which, "out");
ensure_equals(history[1].what, "*eof*");
ensure_equals(history[2].which, "err");
- ensure_equals(history[2].what, "stderr after wait\n");
+ ensure_equals(history[2].what, "stderr after wait" EOL);
ensure_equals(history[3].which, "err");
ensure_equals(history[3].what, "*eof*");
}