]> git.ipfire.org Git - ipfire-3.x.git/blame - dejagnu/patches/dejagnu-1.4.4-testsuite.patch
gdbm: Update to 1.12
[ipfire-3.x.git] / dejagnu / patches / dejagnu-1.4.4-testsuite.patch
CommitLineData
e220cfe6
MT
1diff -Burp dejagnu-1.4.4/testsuite/libdejagnu/unit.cc dejagnu-1.4.4-pm/testsuite/libdejagnu/unit.cc
2--- dejagnu-1.4.4/testsuite/libdejagnu/unit.cc 2003-08-17 03:33:06.000000000 +0200
3+++ dejagnu-1.4.4-pm/testsuite/libdejagnu/unit.cc 2007-10-03 18:31:03.000000000 +0200
4@@ -7,6 +7,7 @@
5 #include <fstream>
6 #include <set>
7 #include <dejagnu.h>
8+#include <sstream>
9
10 using namespace std;
11
12@@ -49,12 +50,8 @@ main (int argc, char *argv[]) {
13 // Replace the output buffer for cout, so we can examine it to
14 // see what was displayed. Otherwise, there is no way we can test
15 // the logging functions completely.
16- char bbuuff[5120];
17-#ifdef __STDC_HOSTED__
18- cout.rdbuf()->pubsetbuf(bbuuff, 5120);
19-#else
20- cout.rdbuf()->setbuf(bbuuff, 5120);
21-#endif
22+ stringstream stream;
23+ streambuf * buf = cout.rdbuf(stream.rdbuf());
24
25 testClass1.tname = "testType1";
26 testClass1.tnum = 1;
27@@ -65,53 +62,59 @@ main (int argc, char *argv[]) {
28
29 // Test the pass message
30 test.pass ("bogus pass message for testing");
31+ cout.flush();
32 outstate = os2;
33- if (strncmp(bbuuff, "\tPAS: bogus pass message", 22) == 0) {
34+ if (strncmp(stream.str().c_str(), "\tPAS: bogus pass message", 22) == 0) {
35 runtest.pass ("Pass message");
36 } else {
37 runtest.fail ("Pass message");
38 }
39+ stream.str("");
40
41 // Test the fail message
42 outstate = os1;
43 test.fail ("bogus fail message for testing");
44 cout.flush();
45 outstate = os2;
46- if (strncmp(bbuuff, "\tFAI: bogus fail message", 22) == 0) {
47+ if (strncmp(stream.str().c_str(), "\tFAI: bogus fail message", 22) == 0) {
48 runtest.pass ("Fail message");
49 } else {
50 runtest.fail ("Fail message");
51 }
52+ stream.str("");
53
54 // Test the untested message
55 outstate = os1;
56 test.untested ("bogus untested message for testing");
57 cout.flush();
58 outstate = os2;
59- if (strncmp(bbuuff, "\tUNT: bogus untested message", 21) == 0) {
60+ if (strncmp(stream.str().c_str(), "\tUNT: bogus untested message", 21) == 0) {
61 runtest.pass ("Untested message");
62 } else {
63 runtest.fail ("Untested message");
64 }
65+ stream.str("");
66
67 // Test the unresolved message
68 outstate = os1;
69 test.unresolved ("bogus unresolved message for testing");
70 cout.flush();
71 outstate = os2;
72- if (strncmp(bbuuff, "\tUNR: bogus unresolved message", 21) == 0) {
73+ if (strncmp(stream.str().c_str(), "\tUNR: bogus unresolved message", 21) == 0) {
74 runtest.pass ("Unresolved message");
75 } else {
76 runtest.fail ("Unresolved message");
77 }
78+ stream.str("");
79
80 // Make sure we got everything in the totals
81 regcomp (&regex_pat, "\r\n\t#passed.*#failed.*#untested.*#unresolved", REG_NOSUB|REG_NEWLINE);
82- if (regexec (&regex_pat, bbuuff, 0, (regmatch_t *)0, 0)) {
83+ if (regexec (&regex_pat, stream.str().c_str(), 0, (regmatch_t *)0, 0)) {
84 runtest.pass ("Totals message");
85 } else {
86 runtest.fail ("Totals message");
87 }
88-}
89-
90+ stream.str("");
91
92+ cout.rdbuf(buf);
93+}