summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlli Savia <ops@iki.fi>2009-10-26 08:34:55 +0000
committerOlli Savia <ops@iki.fi>2009-10-26 08:34:55 +0000
commit5b013abb219aff3ed6065debf86ad74569b01c54 (patch)
treee1e209d1f2bdf3761863539285948ea34920510d
parent925ba36582e1f871d9c5f2cc8c165cf5b4bfcd50 (diff)
downloadATCD-5b013abb219aff3ed6065debf86ad74569b01c54.tar.gz
ChangeLogTag: Mon Oct 26 08:32:08 UTC 2009 Olli Savia <ops@iki.fi>
-rw-r--r--ACE/ChangeLog7
-rw-r--r--ACE/tests/OS_Test.cpp50
2 files changed, 54 insertions, 3 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index c77984e828b..c7c3e8cbcf6 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,10 @@
+Mon Oct 26 08:32:08 UTC 2009 Olli Savia <ops@iki.fi>
+
+ * tests/OS_Test.cpp:
+ Improved test to detect if std{out,err} is not associated
+ with an output stream. This may happen with Windows application
+ without a console window.
+
Mon Oct 26 07:48:19 UTC 2009 Olli Savia <ops@iki.fi>
* ace/config-win32-msvc-10.h:
diff --git a/ACE/tests/OS_Test.cpp b/ACE/tests/OS_Test.cpp
index 806bd468520..484136a892d 100644
--- a/ACE/tests/OS_Test.cpp
+++ b/ACE/tests/OS_Test.cpp
@@ -76,21 +76,65 @@ fileno_test (void)
int test_status = 0;
- if (ACE_OS::fileno (stdin) != ACE_STDIN)
+ ACE_HANDLE fn;
+
+ fn = ACE_OS::fileno (stdin);
+ if (fn == -1)
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("fileno returned -1 (stdin).\n")));
+ test_status = -1;
+ }
+ else if (fn != ACE_STDIN)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("stdin test failed.\n")));
test_status = -1;
}
- if (ACE_OS::fileno (stdout) != ACE_STDOUT)
+
+ fn = ACE_OS::fileno (stdout);
+ if (fn == -1)
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("fileno returned -1 (stdout).\n")));
+ test_status = -1;
+ }
+ else
+#if defined (ACE_WIN32)
+ // Check if stdout is not associated with an output stream.
+ // This not an error.
+ if (fn == -2)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("fileno returned -2 (stdout).\n")));
+ }
+ else
+#else
+ if (fn != ACE_STDOUT)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("stdout test failed.\n")));
test_status = -1;
}
- if (ACE_OS::fileno (stderr) != ACE_STDERR)
+#endif
+
+ fn = ACE_OS::fileno (stderr);
+ if (fn == -1)
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("fileno returned -1 (stderr).\n")));
+ test_status = -1;
+ }
+ else
+#if defined (ACE_WIN32)
+ // Check if stderr is not associated with an output stream.
+ // This not an error.
+ if (fn == -2)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("fileno returned -2 (stderr).\n")));
+ }
+ else
+#else
+ if (fn != ACE_STDERR)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("stderr test failed.\n")));
test_status = -1;
}
+#endif
return test_status;
}