Changeset 925
- Timestamp:
- Aug 1, 2011, 3:20:02 PM (14 years ago)
- Location:
- tests/process/process-sync
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/process/process-sync/process-sync-test.cmd
r915 r925 20 20 /* run */ 21 21 '@del bigfile.txt.out 1>nul 2>nul' 22 'process-sync.exe read bigfile.txt'22 'process-sync.exe read_out bigfile.txt' 23 23 /* compare results */ 24 24 'comp bigfile.txt bigfile.txt.out < n' 25 if (rc \= 0) then do 26 say 'ERROR: rc = 'rc' (i = 'i')' 27 signal done 28 end 29 end 30 31 do i = 1 to 100 32 /* run */ 33 '@del bigfile.txt.err 1>nul 2>nul' 34 'process-sync.exe read_err bigfile.txt' 35 /* compare results */ 36 'comp bigfile.txt bigfile.txt.err < n' 25 37 if (rc \= 0) then do 26 38 say 'ERROR: rc = 'rc' (i = 'i')' -
tests/process/process-sync/process-sync.cpp
r914 r925 57 57 } 58 58 59 int test_read(const QString &aFile) 60 { 61 printf ("test_read: Read '%s' from child's stdout " 62 "and write it to '%s.out'\n", aFile.toLocal8Bit().constData(), 63 aFile.toLocal8Bit().constData()); 64 65 QString aOutFile = aFile + ".out"; 59 int test_read(const QString &aFile, bool aToStdErr) 60 { 61 const char *ext = aToStdErr ? "err" : "out"; 62 63 printf ("test_read: Read '%s' from child's std%s " 64 "and write it to '%s.%s'\n", aFile.toLocal8Bit().constData(), 65 ext, aFile.toLocal8Bit().constData(), ext); 66 67 QString aOutFile = aFile + "." + ext; 66 68 QProcess p; 67 69 QFile f (aOutFile); 68 70 71 p.setReadChannel (aToStdErr ? QProcess::StandardError : 72 QProcess::StandardOutput); 73 69 74 if (f.open (QIODevice::WriteOnly)) 70 75 { 71 76 p.start ("child", 72 QStringList() << "1"<< aFile,77 QStringList() << (aToStdErr ? "2" : "1") << aFile, 73 78 QIODevice::ReadOnly); 74 79 … … 207 212 if (argc == 3) 208 213 { 209 if (qstrcmp (argv [1], "read") == 0) 210 return test_read (QLatin1String (argv [2])); 211 if (qstrcmp (argv [1], "write") == 0) 214 if (qstrcmp (argv [1], "read_out") == 0) 215 return test_read (QLatin1String (argv [2]), false); 216 if (qstrcmp (argv [1], "read_err") == 0) 217 return test_read (QLatin1String (argv [2]), true); 218 if (qstrcmp (argv [1], "write") == 0) 212 219 return test_write(QLatin1String (argv [2])); 213 220 } … … 225 232 } 226 233 227 printf ("Usage: testcase read |write <filename>\n"234 printf ("Usage: testcase read_out|read_err|write <filename>\n" 228 235 " testcase sleep|hang\n"); 229 236
Note:
See TracChangeset
for help on using the changeset viewer.