public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Add test: readScalar()/writeScalar() should be able to handle arbitrary 
binary data.
Hongli Lai (Phusion) (author)
Wed Feb 27 15:18:02 -0800 2008
commit  462ed78b879e8134df35f74c9e9b499059df63b5
tree    36672a77b5b375cb927bb3440e44d52cb6131436
parent  92692d6ea3623613cf79b2c2dba236f324dd9a9b
...
283
284
285
286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
...
283
284
285
 
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
0
@@ -283,5 +283,28 @@ namespace tut {
0
     }
0
   }
0
   
0
- // TODO: readScalar()/writeScalar() should be able to handle arbitrary binary data
0
+ TEST_METHOD(12) {
0
+ // readScalar()/writeScalar() should be able to handle arbitrary binary data.
0
+ string data;
0
+ FILE *f = fopen("stub/garbage3.dat", "r");
0
+ while (!feof(f)) {
0
+ char buf[1024 * 32];
0
+ size_t ret = fread(buf, 1, sizeof(buf), f);
0
+ data.append(buf, ret);
0
+ }
0
+ fclose(f);
0
+
0
+ pid_t pid = fork();
0
+ if (pid == 0) {
0
+ reader.close();
0
+ writer.writeScalar(data);
0
+ _exit(0);
0
+ } else {
0
+ writer.close();
0
+ string result;
0
+ reader.readScalar(result);
0
+ ensure_equals(result, data);
0
+ waitpid(pid, NULL, 0);
0
+ }
0
+ }
0
 }

Comments

    No one has commented yet.