Author: faridz
Date: Mon May 12 11:09:31 2008
New Revision: 655584
URL: http://svn.apache.org/viewvc?rev=655584&view=rev
Log:
2008-05-12 Farid Zaripov <[EMAIL PROTECTED]>
* tests/src/driver.cpp (_rw_opt_no_popups) [_WIN32]: New function for
handling
--no-popups option (disables Windows and MSVC CRT popup windows).
(_rw_opt_debug_heap) [_MSC_VER && _DEBUG]: New function for handling
--debug-heap
option (enables the intensive heap memory checking).
(_rw_setopts_windows)[_WIN32]: New function for installing handlers for
--no-popups
and --debug-heap options.
(rw_vtest) [_WIN32]: Call _rw_setopts_windows().
* etc/config/windows/projects.js (CreateProjectDefs): Added --no-popups
option
when running tests using exec utility.
Modified:
stdcxx/branches/4.2.x/etc/config/windows/projects.js
stdcxx/branches/4.2.x/tests/src/driver.cpp
Modified: stdcxx/branches/4.2.x/etc/config/windows/projects.js
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/etc/config/windows/projects.js?rev=655584&r1=655583&r2=655584&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/etc/config/windows/projects.js (original)
+++ stdcxx/branches/4.2.x/etc/config/windows/projects.js Mon May 12 11:09:31
2008
@@ -334,7 +334,7 @@
" /PRJDIR:\"" + runtestsDef.VCProjDir + "\"" +
" /CONFIG:\"%SOLUTION%\"" +
" /LOGFILE:\"runtests.log\"" +
- " /RUNFLAGS:\"--compat -x \'--compat -O -\' -t " + EXEC_TIMEOUT + "\"";
+ " /RUNFLAGS:\"--compat -x \'--no-popups --compat -O -\' -t " +
EXEC_TIMEOUT + "\"";
runtestsDef.CustomBuildOut = "$(OutDir)\\runtests.log";
runtestsDef.CustomBuildDeps = "%FILES%";
//runtestsDef.PrjDeps.push(alltestsDef);
Modified: stdcxx/branches/4.2.x/tests/src/driver.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/src/driver.cpp?rev=655584&r1=655583&r2=655584&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/src/driver.cpp (original)
+++ stdcxx/branches/4.2.x/tests/src/driver.cpp Mon May 12 11:09:31 2008
@@ -45,9 +45,13 @@
#include <stdlib.h> // for free
#include <string.h> // for strchr, strcpy
+#ifdef _WIN32
+# include <windows.h> // for SetErrorMode()
+#endif // _WIN32
+
#ifdef _MSC_VER
# include <crtdbg.h> // for _CrtSetReportMode(), _CrtSetDbgFlag()
-#endif
+#endif // _MSC_VER
#if !defined (_WIN32) && !defined (_WIN64)
# include <unistd.h> // for isatty()
@@ -492,12 +496,6 @@
// set mode: enable the option
opt_verbose = 1;
-#ifdef _MSC_VER
- _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF
- | _CRTDBG_CHECK_ALWAYS_DF
- | _CRTDBG_LEAK_CHECK_DF);
-#endif
-
return 0;
}
@@ -547,12 +545,6 @@
// set mode: enable the option
opt_compat = 1;
-#ifdef _MSC_VER
- _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_DEBUG);
- _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_DEBUG);
- _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
-#endif
-
return 0;
}
@@ -930,6 +922,128 @@
return 0;
}
+
+#ifdef _WIN32
+
+static int
+_rw_opt_no_popups (int argc, char *argv[])
+{
+ static int opt_no_popups;
+
+ if (0 == argc) {
+ // query mode: return the value of the option
+ return opt_no_popups;
+ }
+
+ if (1 == argc && argv && 0 == argv [0]) {
+ // help mode: set argv[0] to the text of the help message
+
+ static const char helpstr[] = {
+ "Prevents the program from using message box popup window's for\n"
+ "error messages.\n"
+ };
+
+ argv [0] = _RWSTD_CONST_CAST (char*, helpstr);
+
+ return 0;
+ }
+
+ // set mode: enable the option
+ opt_no_popups = 1;
+
+ SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
+
+# ifdef _MSC_VER
+ _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile (_CRT_WARN, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile (_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile (_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+# endif // _MSC_VER
+
+ return 0;
+}
+
+#endif // _WIN32
+
+
+#if defined (_MSC_VER) && defined (_DEBUG)
+
+static int
+_rw_opt_debug_heap (int argc, char *argv[])
+{
+ static int opt_debug_heap;
+
+ if (0 == argc) {
+ // query mode: return the value of the option
+ return opt_debug_heap;
+ }
+
+ if (1 == argc && argv && 0 == argv [0]) {
+ // help mode: set argv[0] to the text of the help message
+
+ static const char helpstr[] = {
+ "Enables the heap consistency checking on every memory
allocation\n"
+ "and deallocation request.\n"
+ };
+
+ argv [0] = _RWSTD_CONST_CAST (char*, helpstr);
+
+ return 0;
+ }
+
+ // set mode: enable the option
+ opt_debug_heap = 1;
+
+ _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF
+ | _CRTDBG_CHECK_ALWAYS_DF
+ | _CRTDBG_LEAK_CHECK_DF);
+
+ return 0;
+}
+
+#endif // _MSC_VER && _DEBUG
+
+
+#ifdef _WIN32
+
+static int
+_rw_setopts_windows ()
+{
+ int nopts =
+ rw_setopts ("|-no-popups ",
+ _rw_opt_no_popups,
+ 0 /* detect missing handlers */);
+
+ if (1 > nopts) {
+ rw_fprintf (rw_stderr,
+ "%s:%d: rw_setopts() failed\n", __FILE__, __LINE__);
+ abort ();
+ return 1;
+ }
+
+# if defined (_MSC_VER) && defined (_DEBUG)
+
+ nopts =
+ rw_setopts ("|-debug-heap ",
+ _rw_opt_debug_heap,
+ 0 /* detect missing handlers */);
+
+ if (1 > nopts) {
+ rw_fprintf (rw_stderr,
+ "%s:%d: rw_setopts() failed\n", __FILE__, __LINE__);
+ abort ();
+ return 1;
+ }
+
+# endif // _MSC_VER && _DEBUG
+
+ return 0;
+}
+
+#endif // _WIN32
+
/************************************************************************/
_TEST_EXPORT int
@@ -995,6 +1109,10 @@
_rw_setopts_lines ();
+#ifdef _WIN32
+ _rw_setopts_windows ();
+#endif // _WIN32
+
int status = rw_runopts (argc, argv);
if (status)