Martin Sebor wrote:
Andrew Black wrote:
[...]
A final method would be to alter the rwtest library to treat the file name of '-' when passed to the -O option as stdout, and make a similar change to the RogueWave internal framework, then run the executables with the options '--compat -O -'. This would likely be less invasive than the other option, and could be considered a useful enhancement.

This approach seems like the right way to go. I just changed
the Rogue Wave driver to recognize a single '-' as a shortcut
for stdout so you can do your thing in the stdcxx driver to
get it all working together.

Martin

Greetings all.

Attached is a patch that implements the rwtest and makefile changes for this option. One problem observed is that the 22.locale.time.get, 22.locale.time.put, and 27.objects now report a FORMAT status. The cause of these messages is output after the assertion count has been printed. The compatibility mode parsing logic searches for the summary total in a different way than the normal mode, and is therefore affected by this output where the normal mode isn't.

--Andrew Black

Changelog:
* tests/src/driver.cpp (_rw_setopt_output_file): Add logic to treat the magic file name of '-' as a reference to stdout. * etc/config/GNUmakefile.tst (RUNFLAGS): Specify compatibility mode flags to enable parsing of legacy tests. * util/output.cpp (check_compat_test): Adjust seek position to avoid false format errors when an executable contains a very small number of tests.
Index: tests/src/driver.cpp
===================================================================
--- tests/src/driver.cpp	(revision 514772)
+++ tests/src/driver.cpp	(working copy)
@@ -609,15 +609,18 @@
     }
 
     if (file_name) {
+        if (file_name[0] != '-' || file_name[1] != '\0') {
+            FILE* const f = fopen (file_name, "w");
 
-        FILE* const f = fopen (file_name, "w");
+            if (f) {
+                if (_rw_ftestout && _rw_ftestout != rw_stdout)
+                    fclose ((FILE*)(void*)_rw_ftestout);
 
-        if (f) {
-            if (_rw_ftestout && _rw_ftestout != rw_stdout)
-                fclose ((FILE*)(void*)_rw_ftestout);
-
-            _rw_ftestout = (rw_file*)(void*)f;
+                _rw_ftestout = (rw_file*)(void*)f;
+            }
         }
+        else
+            _rw_ftestout = (rw_file*)(void*)stdout;
     }
 
     // return 0 on success, any non-zero value on failure
Index: etc/config/GNUmakefile.tst
===================================================================
--- etc/config/GNUmakefile.tst	(revision 514772)
+++ etc/config/GNUmakefile.tst	(working copy)
@@ -71,6 +71,8 @@
   LDFLAGS += $(RPATH)$(LIBDIR):$(BUILDDIR)/rwtest
 endif
 
+RUNFLAGS = --compat -x "--compat -O -"
+
 ##############################################################################
 #  TARGETS
 ##############################################################################
Index: util/output.cpp
===================================================================
--- util/output.cpp	(revision 514772)
+++ util/output.cpp	(working copy)
@@ -145,7 +145,7 @@
     assert (0 != data);
     assert (0 != status);
 
-    fseek (data, -80, SEEK_END); /* Seek near the end of the file */
+    fseek (data, -70, SEEK_END); /* Seek near the end of the file */
 
     for (tok = fgetc (data); fsm < 4 && !feof (data); tok = fgetc (data)) {
         switch (tok) {

Reply via email to