1 martin 1.46 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.47 //
|
3 martin 1.46 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.47 //
|
10 martin 1.46 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.47 //
|
17 martin 1.46 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.47 //
|
20 martin 1.46 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.47 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.46 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.47 //
|
28 martin 1.46 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.2 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include <fstream>
33 #include <cstring>
34 #include <Pegasus/Common/System.h>
35 #include <Pegasus/Common/Tracer.h>
|
36 thilo.boehm 1.39 #include <Pegasus/Common/TraceMemoryHandler.h>
|
37 a.arora 1.17 #include <Pegasus/Common/AutoPtr.h>
|
38 sushma.fernandes 1.30 #include <Pegasus/Common/SharedPtr.h>
39 #include <Pegasus/Common/CIMClass.h>
40 #include <Pegasus/Common/CIMMessage.h>
41 #include <Pegasus/Common/XmlWriter.h>
42 #include <Pegasus/Common/AcceptLanguageList.h>
43 #include <Pegasus/Common/ContentLanguageList.h>
|
44 mike 1.2
45 PEGASUS_USING_STD;
46 PEGASUS_USING_PEGASUS;
47
|
48 amit99shah 1.50 //constants value
49 const Uint32 _traceFileSizeKBytes=10240;
50 const Uint32 _numberOfTraceFiles=3;
|
51 marek 1.35
52 // Trace Levels 0 and 5 are defined as private constants of the tracer
53 // class to avoid inappropriate use in the trace calls and macros.
54 // Therefore these tracel levels need to be set in the tests using the
55 // constant values directly.
56 const Uint32 PEGASUS_TRACER_LEVEL0 = 0;
57 const Uint32 PEGASUS_TRACER_LEVEL5 = (1 << 4);
58
59
|
60 mike 1.2 // Trace files for test purposes
|
61 kumpf 1.11 // Will be created in the $(PEGASUS_TMP) directory, or if not set,
62 // in the current directory
|
63 kumpf 1.15 CString FILE1;
64 CString FILE2;
65 CString FILE3;
66 CString FILE4;
|
67 thilo.boehm 1.39 CString FILE5;
68
69 // A message string for testing the tracer with variable arguments
70 #define VAR_TEST_MESSAGE "Variable length part of message"
71
|
72 mike 1.2
|
73 kumpf 1.43 //
74 // Reads the last trace message from a given trace file and compares the
|
75 mike 1.2 // given string with the string read from file
76 //
77 // return 0 if the strings match
78 // return 1 if the strings do not match
79 //
|
80 kumpf 1.31 Uint32 compare(const char* fileName, const char* expectedMessage)
|
81 mike 1.2 {
|
82 kumpf 1.31 int expectedMessageLength = strlen(expectedMessage);
83
84 // Compute the size of the message in the trace file. Include the final
85 // EOL character added by the Tracer. This size will be used to seek
86 // from the end of the file back to the beginning of the trace message.
87 int seekBytes = expectedMessageLength + 1;
88
89 #if defined(PEGASUS_OS_TYPE_WINDOWS)
90 // Windows converts all '\n' characters to "\r\n" sequences in the trace
91 // file. Increase the seekBytes by the number of '\r' characters added
92 // when the message is written to the file.
93 for (const char* newlineChar = expectedMessage;
94 ((newlineChar = strchr(newlineChar, '\n')) != 0);
95 newlineChar++)
96 {
97 seekBytes++;
98 }
99
100 // Count the '\r' character added with the final '\n' written by the Tracer
101 seekBytes++;
102 #endif
103 kumpf 1.31
104 AutoArrayPtr<char> actualMessage(new char[expectedMessageLength + 1]);
105
106 // Read the trace message from the file, minus the message prefix and
107 // minus the trailing newline.
|
108 mike 1.2 fstream file;
|
109 kumpf 1.31 file.open(fileName, fstream::in);
|
110 mike 1.2 if (!file.good())
111 {
|
112 kumpf 1.31 return 1;
|
113 mike 1.2 }
|
114 kumpf 1.31 file.seekg(-seekBytes, fstream::end);
115 file.read(actualMessage.get(), expectedMessageLength);
116 file.close();
117 actualMessage[expectedMessageLength] = 0;
118
119 // Compare the expected and actual messages
120 Uint32 retCode = strcmp(expectedMessage, actualMessage.get());
121
|
122 thilo.boehm 1.39 // Diagnostic to determine string differences
|
123 kumpf 1.31 if (retCode)
124 cout << "Compare Error: expectedMessage= \n\"" << expectedMessage <<
125 "\". actualMessage= \n\"" << actualMessage.get() << "\"" << endl;
|
126 karl 1.27
|
127 mike 1.2 return retCode;
128 }
129
130 //
131 // Description:
132 // Trace properties file, level and component are not set
133 // Should not log a trace message
134 //
135 // Type:
|
136 kumpf 1.43 // Negative
|
137 mike 1.2 //
138 // return 0 if the test passed
139 // return 1 if the test failed
140 //
141 Uint32 test1()
142 {
|
143 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG,"test1");
|
144 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s %d",
145 "This message should not appear value=",123));
|
146 kumpf 1.10 PEG_METHOD_EXIT();
|
147 kumpf 1.34 return System::exists(FILE1) ? 1 : 0;
|
148 mike 1.2 }
149
150 //
151 // Description:
152 // Trace properties level and component are not set
153 // Should not log a trace message
154 //
155 // Type:
|
156 kumpf 1.43 // Negative
|
157 mike 1.2 //
158 // return 0 if the test passed
159 // return 1 if the test failed
160 //
161 Uint32 test2()
162 {
163 Tracer::setTraceFile(FILE1);
|
164 amit99shah 1.50 Tracer::setMaxTraceFileSize (_traceFileSizeKBytes);
165 Tracer::setMaxTraceFileNumber(_numberOfTraceFiles);
|
166 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG,"test2");
|
167 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s %d",
168 "This message should not appear value=",123));
|
169 thilo.boehm 1.42 Uint32 fileSize = 0;
|
170 kumpf 1.34 System::getFileSize(FILE1, fileSize);
171 return (fileSize == 0) ? 0 : 1;
|
172 mike 1.2 }
173
174 //
175 // Description:
176 // Trace properties component is not set
177 // Should not log a trace message
178 //
179 // Type:
|
180 kumpf 1.43 // Negative
|
181 mike 1.2 //
182 // return 0 if the test passed
183 // return 1 if the test failed
184 //
185 Uint32 test3()
186 {
187 Tracer::setTraceLevel(Tracer::LEVEL1);
|
188 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG,"test3");
|
189 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s",
190 "This message should not appear"));
|
191 thilo.boehm 1.42 Uint32 fileSize = 0;
|
192 kumpf 1.34 System::getFileSize(FILE1, fileSize);
193 return (fileSize == 0) ? 0 : 1;
|
194 mike 1.2 }
195
196 //
197 // Description:
198 // Trace properties file, level and component are set
199 // should log a trace message
200 //
201 // Type:
|
202 kumpf 1.43 // Positive
|
203 mike 1.2 //
204 // return 0 if the test passed
205 // return 1 if the test failed
206 //
207 Uint32 test4()
208 {
|
209 marek 1.37 Tracer::setTraceLevel(Tracer::LEVEL1);
|
210 mike 1.2 Tracer::setTraceComponents("Config");
|
211 ashok.pathak 1.49 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL1,"test4");
212 return(compare(FILE1,"test4"));
|
213 mike 1.2 }
214
215 //
216 // Description:
217 // Trace component is set to an invalid component
218 // should not log a trace message
219 //
220 // Type:
|
221 kumpf 1.43 // Negative
|
222 mike 1.2 //
223 // return 0 if the test passed
224 // return 1 if the test failed
225 //
226 Uint32 test5()
227 {
228 Tracer::setTraceComponents("Wrong Component Name");
|
229 karl 1.27
|
230 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG,"test5");
231 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL1,"test5");
|
232 karl 1.27 PEG_METHOD_EXIT();
|
233 marek 1.37 return(compare(FILE1,"test4"));
|
234 mike 1.2 }
235
236 //
237 // Description:
|
238 kumpf 1.43 // Trace level is set to LEVEL 2 and logs a LEVEL 4 message
|
239 mike 1.2 // should not log a trace message
240 //
241 // Type:
|
242 kumpf 1.43 // Negative
|
243 mike 1.2 //
244 // return 0 if the test passed
245 // return 1 if the test failed
246 //
247
248 Uint32 test6()
249 {
250 Tracer::setTraceComponents("Config");
251 Tracer::setTraceLevel(Tracer::LEVEL2);
|
252 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s %s",
|
253 ashok.pathak 1.49 "Test Message for Level2 in","test6"));
|
254 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s %s",
|
255 ashok.pathak 1.49 "Test Message for Level2 in","test6"));
|
256 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL4,"%s",
257 "This Message should not appear"));
|
258 mike 1.2 return(compare(FILE1,"Test Message for Level2 in test6"));
259 }
260
261 //
262 // Description:
263 // Trace level is set to an invalid level
264 // should not log a trace message
265 //
266 // Type:
|
267 kumpf 1.43 // Negative
|
268 mike 1.2 //
269 // return 0 if the test passed
270 // return 1 if the test failed
271 //
272 Uint32 test7()
273 {
274 Tracer::setTraceLevel(100);
|
275 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG,"test7");
|
276 karl 1.27 PEG_METHOD_EXIT();
|
277 mike 1.2 return(compare(FILE1,"Test Message for Level2 in test6"));
278 }
279
280 //
281 // Description:
|
282 kumpf 1.43 // Changes the trace file to FILE2
|
283 mike 1.2 //
284 // Type:
|
285 kumpf 1.43 // Positive
|
286 mike 1.2 //
287 // return 0 if the test passed
288 // return 1 if the test failed
289 //
290 Uint32 test9()
291 {
292 Tracer::setTraceLevel(Tracer::LEVEL3);
293 Tracer::setTraceFile(FILE2);
294
|
295 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG,"test9");
|
296 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL3,"%s %s",
|
297 ashok.pathak 1.49 "Test Message for Level3 in","test9"));
|
298 mike 1.2 return(compare(FILE2,"Test Message for Level3 in test9"));
299 }
300
301 //
302 // Description:
303 // Passes invalid component in the trace call
304 // should not log a trace message
305 //
306 // Type:
|
307 kumpf 1.43 // Negative
|
308 mike 1.2 //
309 // return 0 if the test passed
310 // return 1 if the test failed
311 //
|
312 marek 1.35 // This test not required with change to
|
313 karl 1.27 // use and test macros only.
|
314 mike 1.2
315 Uint32 test10()
316 {
317 Tracer::setTraceComponents("ALL");
|
318 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG,"test10");
|
319 karl 1.27 PEG_METHOD_EXIT();
|
320 mike 1.2 return(compare(FILE2,"Test Message for Level3 in test9"));
321 }
322
323 //
324 // Description:
|
325 marek 1.35 // Trace is set to level 0
326 // should not log a trace message
|
327 mike 1.2 //
328 // Type:
|
329 marek 1.35 // Negative
|
330 mike 1.2 //
331 // return 0 if the test passed
332 // return 1 if the test failed
333 //
334
335 Uint32 test11()
336 {
337 Tracer::setTraceComponents("ALL");
|
338 marek 1.35 Tracer::setTraceLevel(PEGASUS_TRACER_LEVEL0);
339 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL1,"%s %s",
|
340 ashok.pathak 1.49 "Test Message for Level0 in","test11"));
|
341 marek 1.35 return(compare(FILE2,"Test Message for Level3 in test9"));
|
342 mike 1.2 }
343
344 //
345 // Description:
346 // Implements trace call for Tracer::Level1
347 // should log a trace message
348 //
349 // Type:
|
350 kumpf 1.43 // Positive
|
351 mike 1.2 //
352 // return 0 if the test passed
353 // return 1 if the test failed
354 //
355
356 Uint32 test12()
357 {
358 Tracer::setTraceComponents("ALL");
359 Tracer::setTraceLevel(Tracer::LEVEL4);
|
360 marek 1.35 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL1,"%s %s",
|
361 ashok.pathak 1.49 "Test Message for Level1 in","test12"));
|
362 marek 1.35 return(compare(FILE2,"Test Message for Level1 in test12"));
|
363 mike 1.2 }
364
365 //
366 // Description:
367 // Implements trace call for Tracer::Level2
368 // should log a trace message
369 //
370 // Type:
|
371 kumpf 1.43 // Positive
|
372 mike 1.2 //
373 // return 0 if the test passed
374 // return 1 if the test failed
375 //
376
377 Uint32 test13()
378 {
379 Tracer::setTraceComponents("ALL");
380 Tracer::setTraceLevel(Tracer::LEVEL4);
|
381 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s %s",
|
382 ashok.pathak 1.49 "Test Message for Level2 in","test13"));
|
383 mike 1.2 return(compare(FILE2,"Test Message for Level2 in test13"));
384 }
385
386 //
387 // Description:
388 // Implements trace call for Tracer::Level3
389 // should log a trace message
390 //
391 // Type:
|
392 kumpf 1.43 // Positive
|
393 mike 1.2 //
394 // return 0 if the test passed
395 // return 1 if the test failed
396 //
397
398 Uint32 test14()
399 {
400 Tracer::setTraceComponents("ALL");
401 Tracer::setTraceLevel(Tracer::LEVEL4);
402 Tracer::setTraceFile(FILE3);
|
403 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL3,"%s %s",
|
404 ashok.pathak 1.49 "Test Message for Level3 in","test14"));
|
405 mike 1.2 return(compare(FILE3,"Test Message for Level3 in test14"));
406 }
407
408 //
409 // Description:
410 // Implements trace call for Tracer::Level4
411 // should log a trace message
412 //
413 // Type:
|
414 kumpf 1.43 // Positive
|
415 mike 1.2 //
416 // return 0 if the test passed
417 // return 1 if the test failed
418 //
419
420 Uint32 test15()
421 {
422 Tracer::setTraceComponents("ALL");
423 Tracer::setTraceLevel(Tracer::LEVEL4);
|
424 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL4,"%s %s",
|
425 ashok.pathak 1.49 "Test Message for Level4 in", "test15"));
|
426 mike 1.2 return(compare(FILE3,"Test Message for Level4 in test15"));
427 }
428
429 //
430 // Description:
|
431 marek 1.35 // Implements trace call for Tracer::Level5 (trace enter/exit)
432 // should log a trace message
433 //
434 // Type:
|
435 kumpf 1.43 // Positive
|
436 marek 1.35 //
437 // return 0 if the test passed
438 // return 1 if the test failed
439 //
440
441 Uint32 test15a()
442 {
443 Tracer::setTraceComponents("ALL");
444 Tracer::setTraceLevel(PEGASUS_TRACER_LEVEL5);
|
445 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG,"test15a");
|
446 marek 1.35 return(compare(FILE3,"Entering method test15a"));
447 }
448
449 //
450 // Description:
451 // Implements trace call for Tracer::Level5 (trace enter/exit)
452 // should log a trace message
453 //
454 // Type:
|
455 kumpf 1.43 // Positive
|
456 marek 1.35 //
457 // return 0 if the test passed
458 // return 1 if the test failed
459 //
460
461 Uint32 test15b()
462 {
463 Tracer::setTraceComponents("ALL");
464 Tracer::setTraceLevel(PEGASUS_TRACER_LEVEL5);
|
465 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG,"test15b");
|
466 marek 1.35 PEG_METHOD_EXIT();
467 return(compare(FILE3,"Exiting method test15b"));
468 }
469
470 //
471 // Description:
|
472 mike 1.2 // calls the setTraceComponents with null string
|
473 marek 1.35 // should not log a trace message
|
474 mike 1.2 //
475 // Type:
|
476 kumpf 1.43 // Negative
|
477 mike 1.2 //
478 // return 0 if the test passed
479 // return 1 if the test failed
480 //
481
482 Uint32 test16()
483 {
|
484 marek 1.37 Tracer::setTraceComponents("ALL");
485 Tracer::setTraceLevel(PEGASUS_TRACER_LEVEL5);
|
486 kumpf 1.43 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL4,"test16 - check value");
|
487 mike 1.2 Tracer::setTraceComponents("");
488 Tracer::setTraceLevel(Tracer::LEVEL4);
|
489 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL4,"%s %s",
|
490 ashok.pathak 1.49 "This Message should not appear in","test16"));
|
491 marek 1.37 return(compare(FILE3,"test16 - check value"));
|
492 mike 1.2 }
493
494 //
495 // Description:
496 // calls the setTraceComponents with one valid and another invalid component
497 // should log a trace message
498 //
499 // Type:
|
500 kumpf 1.43 // Negative
|
501 mike 1.2 //
502 // return 0 if the test passed
503 // return 1 if the test failed
504 //
505
506 Uint32 test17()
507 {
|
508 marek 1.37 Tracer::setTraceComponents("ALL");
509 Tracer::setTraceLevel(PEGASUS_TRACER_LEVEL5);
|
510 kumpf 1.43 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL4,"test17 - check value");
|
511 kumpf 1.3 Tracer::setTraceComponents("InvalidComp");
|
512 mike 1.2 Tracer::setTraceLevel(Tracer::LEVEL4);
|
513 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL4,"%s %s",
|
514 ashok.pathak 1.49 "This Message should not appear in", "test17"));
|
515 marek 1.37 return(compare(FILE3,"test17 - check value"));
|
516 mike 1.2 }
|
517 kumpf 1.3 //
518 // Description:
519 // calls the _traceBuffer call
520 // should log a trace message
521 //
522 // Type:
523 // Positive
524 //
525 // return 0 if the test passed
526 // return 1 if the test failed
527 //
528
529 Uint32 test18()
530 {
531 Tracer::setTraceComponents("Config,InvalidComp");
532 Tracer::setTraceLevel(Tracer::LEVEL4);
|
533 marek 1.33 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL4,
|
534 marek 1.28 "This Message should appear in");
535 return(compare(FILE3,"This Message should appear in"));
|
536 kumpf 1.3 }
|
537 mike 1.2
|
538 kumpf 1.4 //
539 // Description:
540 // Trace a string.
|
541 marek 1.33 // Calls the PEG_TRACE macro
|
542 kumpf 1.4 // should log a trace message
543 //
544 // Type:
545 // Positive
546 //
547 // return 0 if the test passed
548 // return 1 if the test failed
549 //
550
551 Uint32 test20()
552 {
553 Tracer::setTraceFile(FILE4);
554 Tracer::setTraceComponents("ALL");
555 Tracer::setTraceLevel(Tracer::LEVEL4);
556
|
557 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG, "test20");
|
558 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL4,
559 "Test Message for Level4 in test20"));
|
560 kumpf 1.4 return(compare(FILE4,"Test Message for Level4 in test20"));
561 }
562
563 //
564 // Description:
565 // Trace a CIMException.
566 // Calls the traceCIMException() method
567 // should log a trace message
568 //
569 // Type:
570 // Positive
571 //
572 // return 0 if the test passed
573 // return 1 if the test failed
574 //
575
576 Uint32 test21()
577 {
578 Tracer::setTraceFile(FILE4);
579 Tracer::setTraceComponents("ALL");
580 Tracer::setTraceLevel(Tracer::LEVEL4);
581 kumpf 1.4
|
582 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG, "test21");
|
583 kumpf 1.4
584 // test tracing CIMException
585 try
586 {
587 throw PEGASUS_CIM_EXCEPTION(
|
588 kumpf 1.43 CIM_ERR_NOT_SUPPORTED,
|
589 kumpf 1.4 "CIM Exception Message for Level4 in test21.");
590 }
|
591 kumpf 1.12 catch (CIMException& e)
|
592 kumpf 1.4 {
593 Tracer::traceCIMException(TRC_CONFIG,Tracer::LEVEL4, e);
594 }
595
596 return 0;
597 }
598
599 //
600 // Description:
601 // Trace a string using macro.
602 // should log a trace message
603 //
604 // Type:
605 // Positive
606 //
607 // return 0 if the test passed
608 // return 1 if the test failed
609 //
610 Uint32 test22()
611 {
612 Tracer::setTraceFile(FILE4);
613 kumpf 1.4 Tracer::setTraceComponents("ALL");
614 Tracer::setTraceLevel(Tracer::LEVEL4);
615
|
616 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG, "test22");
|
617 kumpf 1.4
|
618 thilo.boehm 1.38 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL4,
619 "Test message for Level4 in test22.");
|
620 kumpf 1.4
621 return(compare(FILE4,"Test message for Level4 in test22."));
622 }
623
|
624 marek 1.28 //
625 // Description:
626 // Trace a character string using macro.
627 // should log a trace message
628 //
629 // Type:
630 // Positive
631 //
632 // return 0 if the test passed
633 // return 1 if the test failed
634 //
635 Uint32 test23()
636 {
637 Tracer::setTraceFile(FILE4);
638 Tracer::setTraceComponents("ALL");
639 Tracer::setTraceLevel(Tracer::LEVEL4);
640
|
641 ashok.pathak 1.49 PEG_METHOD_ENTER(TRC_CONFIG, "test23");
|
642 marek 1.28
|
643 karl 1.29 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL4,
644 "Test message for Level4 in test23.");
|
645 marek 1.28
646 return(compare(FILE4,"Test message for Level4 in test23."));
647 }
648
|
649 r.kieninger 1.36 //
650 // Description:
651 // Change traceFacility to Logger
652 // No more trace messages should be written
653 //
654 // Type:
655 // Negative
656 //
657 // return 0 if the test passed
658 // return 1 if the test failed
659 //
660 Uint32 test24()
661 {
662 Tracer::setTraceFacility("Log");
663 Tracer::setTraceFile(FILE4);
664 Tracer::setTraceComponents("ALL");
665 Tracer::setTraceLevel(Tracer::LEVEL4);
666
667 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL4,
668 "Test message for traceFacility=Log in test24.");
669
670 r.kieninger 1.36 return(compare(FILE4,"Test message for Level4 in test23."));
671 }
672
673 //
674 // Description:
675 // Change traceFacility back to File
676 // Trace messages should be written again
677 //
678 // Type:
679 // Positive
680 //
681 // return 0 if the test passed
682 // return 1 if the test failed
683 //
684 Uint32 test25()
685 {
686 Tracer::setTraceFacility("File");
687 Tracer::setTraceFile(FILE4);
688 Tracer::setTraceComponents("ALL");
689 Tracer::setTraceLevel(Tracer::LEVEL4);
690
691 r.kieninger 1.36 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL4,
692 "Test message for traceFacility=File in test25.");
693
694 return(compare(FILE4,"Test message for traceFacility=File in test25."));
695 }
696
|
697 kumpf 1.43 //
|
698 sushma.fernandes 1.30 // Description:
699 // Test the getHTTPRequestMessage method.
700 //
701 // Type:
702 // Positive
703 // Tests with a HTTP Request without a basic authorization header.
704 // Message is written to trace file without any changes.
705 //
706 // return 0 if the test passed
707 // return 1 if the test failed
708 //
|
709 r.kieninger 1.36 Uint32 test26()
|
710 sushma.fernandes 1.30 {
711 Tracer::setTraceFile(FILE4);
712 Tracer::setTraceComponents("xmlio");
713 Tracer::setTraceLevel(Tracer::LEVEL2);
714
715 CIMPropertyList propertyList;
716 Buffer params;
717 AcceptLanguageList al;
|
718 kumpf 1.43 ContentLanguageList cl;
|
719 sushma.fernandes 1.30
720 XmlWriter::appendClassNameIParameter(
721 params, "ClassName", CIMName("testclass"));
722 Buffer buffer = XmlWriter::formatSimpleIMethodReqMessage(
723 "localhost",
|
724 kumpf 1.43 CIMNamespaceName("test/cimv2"),
|
725 sushma.fernandes 1.30 CIMName ("EnumerateInstanceNames"),
|
726 kumpf 1.43 "12345",
|
727 sushma.fernandes 1.30 HTTP_METHOD__POST,
728 "Basic: Authorization AAAAA",
729 al,
730 cl,
|
731 mike 1.45 params,
732 false);
|
733 sushma.fernandes 1.30
734 SharedArrayPtr<char> reqMsg(Tracer::getHTTPRequestMessage(
735 buffer));
736
737 PEG_TRACE((
|
738 kumpf 1.43 TRC_XML_IO,
|
739 sushma.fernandes 1.30 Tracer::LEVEL2,
740 "<!-- Request: queue id: %u -->\n%s",
|
741 ashok.pathak 1.49 18,
|
742 sushma.fernandes 1.30 reqMsg.get()));
743
744 return(compare(FILE4, buffer.getData()));
|
745 kumpf 1.43 }
746
747 //
|
748 sushma.fernandes 1.30 // Description:
749 // Test the getHTTPRequestMessage method.
750 //
751 // Type:
752 // Positive
753 // Tests with a HTTP Request that contains a Basic authorization header.
|
754 kumpf 1.43 // The user/password info in the message is suppressed before writing it to
|
755 sushma.fernandes 1.30 // the trace file.
756 //
757 // return 0 if the test passed
758 // return 1 if the test failed
759 //
|
760 r.kieninger 1.36 Uint32 test27()
|
761 kumpf 1.43 {
|
762 sushma.fernandes 1.30 Tracer::setTraceFile(FILE4);
763 Tracer::setTraceComponents("xmlio");
764 Tracer::setTraceLevel(Tracer::LEVEL2);
765
766 CIMPropertyList propertyList;
767 Buffer params;
768 AcceptLanguageList al;
769 ContentLanguageList cl;
770 String authHeader = "Authorization: Basic ABCDEABCDE==";
771 String MSGID = "32423424";
772
773 XmlWriter::appendClassNameIParameter(
|
774 kumpf 1.43 params,
775 "ClassName",
|
776 sushma.fernandes 1.30 CIMName("testclass"));
777 Buffer buffer = XmlWriter::formatSimpleIMethodReqMessage(
778 "localhost",
|
779 kumpf 1.43 CIMNamespaceName("test/cimv2"),
|
780 sushma.fernandes 1.30 CIMName ("EnumerateInstanceNames"),
|
781 kumpf 1.43 MSGID,
|
782 sushma.fernandes 1.30 HTTP_METHOD__POST,
783 authHeader,
784 al,
785 cl,
|
786 mike 1.45 params,
787 false);
|
788 sushma.fernandes 1.30
789 PEG_TRACE((
|
790 kumpf 1.43 TRC_XML_IO,
|
791 sushma.fernandes 1.30 Tracer::LEVEL2,
792 "<!-- Request: queue id: %u -->\n%s",
|
793 ashok.pathak 1.49 18,
|
794 sushma.fernandes 1.30 Tracer::getHTTPRequestMessage(
795 buffer).get()));
|
796 kumpf 1.43
|
797 sushma.fernandes 1.30 String testStr(buffer.getData());
798 Uint32 pos = testStr.find("ABCDEABCDE==");
|
799 kumpf 1.43
|
800 sushma.fernandes 1.30 for ( Uint32 i = pos; i < pos+strlen("ABCDEABCDE=="); i++)
801 testStr[i] = 'X';
802
803 return(compare(FILE4, testStr.getCString()));
804 }
805
|
806 thilo.boehm 1.39
807 //----------------------------------------------------------
808 // Tests for the traceMemoryHandler
809 //----------------------------------------------------------
810 typedef struct TTTParmType
811 {
812 Thread *trd;
813 TraceMemoryHandler *trcHandler;
814 const char* trcMessage;
815 Uint32 msgLen;
816 Uint32 number;
817 Boolean isVariableMsg;
818 } TTTParm;
819
820
821 void traceVariableArgs( TraceMemoryHandler *trcHdler,
822 const char* msg, Uint32 msgLen, const char* fmt, ...)
823 {
824 va_list ap;
825 va_start(ap, fmt);
826 trcHdler->handleMessage(msg, msgLen, fmt, ap);
827 thilo.boehm 1.39 va_end(ap);
828 }
829
830 ThreadReturnType PEGASUS_THREAD_CDECL tracerThread( void* parm )
831 {
832 Thread *my_handle = (Thread *)parm;
833 TTTParm * my_parm = (TTTParm *)my_handle->get_parm();
|
834 kumpf 1.43
|
835 thilo.boehm 1.40 Threads::yield();
|
836 thilo.boehm 1.39 for (Uint32 x=0; x < my_parm->number; x++)
837 {
838 if (x % 911 == 0 )
839 {
840 // Give other threads time to run.
|
841 thilo.boehm 1.40 Threads::yield();
|
842 thilo.boehm 1.39 }
843 if (my_parm->isVariableMsg)
844 {
845 traceVariableArgs(my_parm->trcHandler,
846 my_parm->trcMessage,
847 my_parm->msgLen,
848 my_parm->trcMessage,
849 VAR_TEST_MESSAGE);
850 }
851 else
852 {
853 my_parm->trcHandler->handleMessage(my_parm->trcMessage,
854 my_parm->msgLen);
|
855 kumpf 1.43 }
|
856 thilo.boehm 1.39 }
|
857 kumpf 1.43
|
858 thilo.boehm 1.39 return ThreadReturnType(0);
859 }
860
861 Uint32 testMemoryHandler(const char* filename)
862 {
863 #define NUM_TEST_THREADS 99
864 Uint32 rc = 0;
865
866 TraceMemoryHandler *trcHdler = new TraceMemoryHandler();
|
867 thilo.boehm 1.42
|
868 thilo.boehm 1.39 const char* trcMsg1 = "1START A short trace message. END1";
869 const char* trcMsg2 = "2START A trace message which is a little longer "
870 "than the previous trace message. END2";
871 const char* trcMsg3 = "3START A trace message which is much longer than "
872 "the previous trace messages, which were small and a "
873 "little larger, but this one is at least double the "
874 "size as both others together. END3";
875 const char* trcMsg4 = "4START <%s> END4";
876 const char* trcMsgs[] = { trcMsg1, trcMsg2, trcMsg3, trcMsg4 };
877 Uint32 numMsgs = sizeof(trcMsgs) / sizeof(const char*);
878
879 TTTParm *tttParms[NUM_TEST_THREADS];
|
880 kumpf 1.43
|
881 thilo.boehm 1.39 for (int x=0; x < NUM_TEST_THREADS; x++)
882 {
883 Uint32 msgNumber = x%numMsgs;
884 tttParms[x] = new TTTParm();
885 tttParms[x]->trd = 0;
886 tttParms[x]->trcHandler = trcHdler;
887 tttParms[x]->trcMessage = trcMsgs[msgNumber];
888 tttParms[x]->msgLen = strlen(trcMsgs[msgNumber]);
889 tttParms[x]->number = 100000;
890 // Is the message a variable one (= the last in the list)?
891 tttParms[x]->isVariableMsg = (msgNumber == (numMsgs-1));
892 }
|
893 kumpf 1.43
|
894 thilo.boehm 1.39 for (int x=0; x < NUM_TEST_THREADS; x++)
895 {
896 tttParms[x]->trd = new Thread(tracerThread, tttParms[x], false);
897 tttParms[x]->trd->run();
898 }
899
900 for (int x=0; x < NUM_TEST_THREADS; x++)
901 {
902 tttParms[x]->trd->join();
903 }
|
904 kumpf 1.43
|
905 kumpf 1.44 // Setting an empty trace file name should fail.
906 PEGASUS_TEST_ASSERT(Tracer::setTraceFile(""));
|
907 kumpf 1.43
908 if (Tracer::setTraceFile(filename))
|
909 thilo.boehm 1.39 {
|
910 thilo.boehm 1.42 cout << "Failure in call to setTraceFile for file \""
|
911 thilo.boehm 1.39 << filename << "\"\n" << endl;
912 PEGASUS_TEST_ASSERT(0);
913 }
|
914 kumpf 1.43
|
915 thilo.boehm 1.39 trcHdler->flushTrace();
|
916 kumpf 1.43
|
917 thilo.boehm 1.39 // To test the variable messages, we replace the variable message
918 // in the list with a resolved copy.
919 Uint32 lastMsg = numMsgs-1;
920 char resolvedMsg[1024];
921 memcpy( resolvedMsg, trcMsgs[lastMsg], strlen(trcMsgs[lastMsg]) );
922 sprintf( resolvedMsg+strlen(trcMsgs[lastMsg]),
923 trcMsgs[lastMsg],
924 VAR_TEST_MESSAGE );
925 trcMsgs[lastMsg] = resolvedMsg;
926
|
927 kumpf 1.43
|
928 thilo.boehm 1.39 // Now analyze the dumped buffer content, to ensure no messages
929 // were damaged.
|
930 kumpf 1.43 // For this we read the buffer content line by line and check if it
|
931 thilo.boehm 1.39 // matches one of the messages from the list above.
932 {
933 fstream file;
934 file.open(filename, fstream::in);
935 if (!file.good())
936 {
937 cout << "Failed to open file \"" << filename << "\"\n" << endl;
938 PEGASUS_TEST_ASSERT(0);
939 }
|
940 kumpf 1.43
941 // Keep the first line on the side, since this is probably the
|
942 thilo.boehm 1.39 // wrapped remainder of the very last messsage in the buffer.
943 char firstLine[256];
944 file.getline( firstLine, 256 );
945
946 char currentLine[256];
947 file.getline( currentLine, 256 );
948
949 while( !file.eof() )
950 {
951 Boolean found = false;
952 for (Uint32 x=0; x < numMsgs; x++)
953 {
954 if ( strcmp(trcMsgs[x], currentLine) == 0 )
955 {
956 found = true;
957 continue;
958 }
959 }
960 if ( !found )
961 {
962 if ( strncmp(currentLine, "*EOTRACE*", strlen("*EOTRACE*")) )
963 thilo.boehm 1.39 {
964 // if we got here, this is either an error, or we reached
965 // the end of the trace buffer, where it had wrapped.
966 // To check this we paste together the message in the
|
967 kumpf 1.43 // first line we read, and which is supposed to be the
|
968 thilo.boehm 1.39 // remainder of the wrapped message.
969 strcat(currentLine, firstLine);
970 for (Uint32 x=0; x < numMsgs; x++)
971 {
972 if ( strcmp(trcMsgs[x], currentLine) == 0 )
973 {
974 found = true;
975 continue;
976 }
977 }
978 if ( !found )
979 {
980 // Diagnostics about the error
981 cout << "Compare Error: unexpected message= \n\""
982 << currentLine << "\"\n" << endl;
983 PEGASUS_TEST_ASSERT(0);
984 }
985 }
986 }
987 file.getline( currentLine, 256 );
988 }
989 thilo.boehm 1.39 file.close();
990 }
991
992
993 for (int x=0; x < NUM_TEST_THREADS; x++)
994 {
995 delete( tttParms[x]->trd );
996 delete( tttParms[x] );
997 }
998
|
999 thilo.boehm 1.41 // test the wrapping of a too long message:
1000 {
1001 #define FIX_PART_OF_MESSAGE "LongMsg:"
1002
|
1003 kumpf 1.43 // The trace buffer is not at that size used for tracing
|
1004 thilo.boehm 1.41 // then it is defined with PEGASUS_TRC_DEFAULT_BUFFER_SIZE_KB*1024
1005 // The resulting message is shriked by:
1006 // * the controll structure traceArea_t ( privat of TraceMemoryHandler)
1007 // * the fixed message part
1008 // * the markers, '\n' and '\0'
|
1009 kumpf 1.43 Uint32 bufferDelta = 2* sizeof(Uint32)+ sizeof(char*)
1010 + PEGASUS_TRC_BUFFER_EYE_CATCHER_LEN
|
1011 thilo.boehm 1.41 + strlen(FIX_PART_OF_MESSAGE)
1012 + strlen(PEGASUS_TRC_BUFFER_TRUNC_MARKER) + 1
|
1013 kumpf 1.43 + strlen(PEGASUS_TRC_BUFFER_EOT_MARKER)+ 1
1014 // this adds the '2' before the truncation marker
|
1015 thilo.boehm 1.41 // should appear in the message
1016 + 1;
1017
1018 Uint32 sizeOfVeryLongMSG=PEGASUS_TRC_DEFAULT_BUFFER_SIZE_KB*1024;
1019
1020 // Construct the big message:
1021 // LongMsg:111...11122222222222222
1022 char* veryLongMSG = (char *)malloc(sizeOfVeryLongMSG);
1023 memset((void*)veryLongMSG,'1',sizeOfVeryLongMSG-bufferDelta);
1024 memset((void*)&(veryLongMSG[sizeOfVeryLongMSG-bufferDelta]),
1025 '2',bufferDelta);
1026 veryLongMSG[sizeOfVeryLongMSG-1] = 0 ;
1027
1028 traceVariableArgs(trcHdler,
1029 FIX_PART_OF_MESSAGE,
1030 strlen(FIX_PART_OF_MESSAGE),
1031 "%s",
1032 veryLongMSG);
1033
|
1034 thilo.boehm 1.42 Tracer::setTraceFile(filename);
|
1035 thilo.boehm 1.41 trcHdler->flushTrace();
1036
1037 // resuse the buffer for reading the result file.
1038 memset((void*)veryLongMSG,0,sizeOfVeryLongMSG);
1039
1040 fstream file;
1041 file.open(filename, fstream::in);
1042 if (!file.good())
1043 {
1044 cout << "Failed to open file \"" << filename << "\"\n" << endl;
1045 PEGASUS_TEST_ASSERT(0);
1046 }
1047
1048 // The first line must be the trucated big message.
1049 file.getline( veryLongMSG, sizeOfVeryLongMSG );
1050
1051 // The second line must be the end of trace marker
1052 char lastLine[256];
1053 file.getline( lastLine, 256 );
1054
1055 // The result must be in the two lines. Close the file
1056 thilo.boehm 1.41 file.close();
1057
1058 // the last line must be only the end of trace marker.
1059 if ( strncmp(lastLine, "*EOTRACE*", strlen("*EOTRACE*")) )
1060 {
1061 cout << "Compare Error: unexpected message= \n\""
1062 << lastLine << "\"\n" << endl;
1063 PEGASUS_TEST_ASSERT(0);
1064 }
1065
1066 char* cursor = veryLongMSG;
1067
|
1068 kumpf 1.43 // The big messsage has the format:
|
1069 thilo.boehm 1.41 // LongMsg:111...1112*TRUNC*
1070 // To validate that the message is truncated at the right position,
1071 // only one '2' has to show up before the truncation marker.
|
1072 kumpf 1.43
|
1073 thilo.boehm 1.41 if ( strncmp(cursor, FIX_PART_OF_MESSAGE
1074 , strlen(FIX_PART_OF_MESSAGE)) )
1075 {
1076 cout << "Compare Error: unexpected message= \n\""
1077 << cursor << "\"\n" << endl;
1078 PEGASUS_TEST_ASSERT(0);
1079 }
1080
1081 cursor = cursor + strlen(FIX_PART_OF_MESSAGE);
1082 int noErrors = 0;
1083 for (int i = 0 ; i < (int)(sizeOfVeryLongMSG-bufferDelta); i++)
1084 {
1085 if (cursor[i] != '1')
1086 {
1087 noErrors++;
1088 cout << "Compare Error: unexpected char '"
|
1089 kumpf 1.43 << cursor[i] << "' at position "
|
1090 thilo.boehm 1.41 << strlen(FIX_PART_OF_MESSAGE) + i
1091 << " expecting '1'." << endl;
1092 // limmit the number of printed errors to 20
1093 if (noErrors > 20 )
1094 {
1095 cout << "Too manny missmatches. Abort long message test"
1096 << endl;
1097 PEGASUS_TEST_ASSERT(0);
1098 }
1099
1100 }
1101 }
1102
1103 // If any error occures in the above test, exit the test.
1104 if (noErrors != 0)
1105 {
1106 PEGASUS_TEST_ASSERT(0);
1107 }
1108
1109 if (cursor[(sizeOfVeryLongMSG-bufferDelta)] != '2')
1110 {
1111 thilo.boehm 1.41 cout << "Compare Error: unexpected char '"
|
1112 kumpf 1.43 << cursor[(sizeOfVeryLongMSG-bufferDelta)] << "' at position "
1113 << strlen(FIX_PART_OF_MESSAGE) +
|
1114 thilo.boehm 1.41 (sizeOfVeryLongMSG-bufferDelta)
1115 << " expecting '2'." << endl;
1116 }
1117
1118 cursor = cursor + (sizeOfVeryLongMSG-bufferDelta) + 1;
1119 if ( strcmp(cursor, "*TRUNC*") )
1120 {
1121 cout << "Compare Error: unexpected message= \n\""
1122 << cursor << "\"\n" << endl;
1123 PEGASUS_TEST_ASSERT(0);
1124 }
1125
1126 free(veryLongMSG);
1127 }
1128
|
1129 thilo.boehm 1.39 delete( trcHdler );
1130 return rc;
1131 }
1132
1133
1134
|
1135 karl 1.7 int main(int argc, char** argv)
|
1136 mike 1.2 {
1137
1138 // Execute the tests only if trace calls are included
1139
1140 #ifdef PEGASUS_REMOVE_TRACE
|
1141 karl 1.7 cout << argv[0] << " +++++ passed all tests" << endl;
|
1142 mike 1.2 return 0;
1143 #else
|
1144 kumpf 1.11
1145 const char* tmpDir = getenv ("PEGASUS_TMP");
1146 if (tmpDir == NULL)
1147 {
1148 tmpDir = ".";
1149 }
1150 String f1 (tmpDir);
|
1151 kumpf 1.13 f1.append("/testtracer1.trace");
|
1152 kumpf 1.14 FILE1 = f1.getCString();
|
1153 kumpf 1.11 String f2 (tmpDir);
|
1154 kumpf 1.13 f2.append("/testtracer2.trace");
|
1155 kumpf 1.14 FILE2 = f2.getCString();
|
1156 kumpf 1.11 String f3 (tmpDir);
|
1157 kumpf 1.13 f3.append("/testtracer3.trace");
|
1158 kumpf 1.14 FILE3 = f3.getCString();
|
1159 kumpf 1.11 String f4 (tmpDir);
|
1160 kumpf 1.13 f4.append("/testtracer4.trace");
|
1161 kumpf 1.14 FILE4 = f4.getCString();
|
1162 thilo.boehm 1.39 String f5 (tmpDir);
1163 f5.append("/testtracer5.trace");
1164 FILE5 = f5.getCString();
|
1165 kumpf 1.11
|
1166 mike 1.2 System::removeFile(FILE1);
1167 System::removeFile(FILE2);
1168 System::removeFile(FILE3);
|
1169 kumpf 1.4 System::removeFile(FILE4);
|
1170 thilo.boehm 1.39 System::removeFile(FILE5);
|
1171 kumpf 1.34 if (test1() != 0)
|
1172 mike 1.2 {
1173 cout << "Tracer test (test1) failed" << endl;
1174 exit(1);
1175 }
|
1176 kumpf 1.34 if (test2() != 0)
|
1177 mike 1.2 {
1178 cout << "Tracer test (test2) failed" << endl;
1179 exit(1);
1180 }
|
1181 kumpf 1.34 if (test3() != 0)
|
1182 mike 1.2 {
1183 cout << "Tracer test (test3) failed" << endl;
1184 exit(1);
1185 }
1186 if (test4() != 0)
1187 {
1188 cout << "Tracer test (test4) failed" << endl;
1189 exit(1);
1190 }
1191 if (test5() != 0)
1192 {
1193 cout << "Tracer test (test5) failed" << endl;
1194 exit(1);
1195 }
1196 if (test6() != 0)
1197 {
1198 cout << "Tracer test (test6) failed" << endl;
1199 exit(1);
1200 }
1201 if (test7() != 0)
1202 {
1203 mike 1.2 cout << "Tracer test (test7) failed" << endl;
1204 exit(1);
1205 }
1206 if (test9() != 0)
1207 {
1208 cout << "Tracer test (test9) failed" << endl;
1209 exit(1);
1210 }
|
1211 kumpf 1.43 /***************************
|
1212 karl 1.27 Test 10 bypassed when tests changed to
1213 use macros. It did an invalid call which is
1214 not possible with macros
1215
|
1216 mike 1.2 if (test10() != 0)
1217 {
1218 cout << "Tracer test (test10) failed" << endl;
1219 exit(1);
1220 }
|
1221 karl 1.27 ******************************/
|
1222 mike 1.2 if (test11() != 0)
1223 {
1224 cout << "Tracer test (test11) failed" << endl;
1225 exit(1);
1226 }
1227 if (test12() != 0)
1228 {
1229 cout << "Tracer test (test12) failed" << endl;
1230 exit(1);
1231 }
1232 if (test13() != 0)
1233 {
1234 cout << "Tracer test (test13) failed" << endl;
1235 exit(1);
1236 }
1237 if (test14() != 0)
1238 {
1239 cout << "Tracer test (test14) failed" << endl;
1240 exit(1);
1241 }
1242 if (test15() != 0)
1243 mike 1.2 {
1244 cout << "Tracer test (test15) failed" << endl;
1245 exit(1);
1246 }
|
1247 marek 1.37 # ifndef PEGASUS_REMOVE_METHODTRACE
|
1248 marek 1.35 if (test15a() != 0)
1249 {
1250 cout << "Tracer test (test15a) failed" << endl;
1251 exit(1);
1252 }
1253 if (test15b() != 0)
1254 {
1255 cout << "Tracer test (test15b) failed" << endl;
1256 exit(1);
1257 }
|
1258 marek 1.37 # endif
|
1259 mike 1.2 if (test16() != 0)
1260 {
1261 cout << "Tracer test (test16) failed" << endl;
|
1262 kumpf 1.3 exit(1);
1263 }
1264 if (test17() != 0)
1265 {
1266 cout << "Tracer test (test17) failed" << endl;
1267 exit(1);
1268 }
1269 if (test18() != 0)
1270 {
1271 cout << "Tracer test (test18) failed" << endl;
1272 exit(1);
1273 }
|
1274 kumpf 1.4 if (test20() != 0)
1275 {
1276 cout << "Tracer test (test20) failed" << endl;
1277 exit(1);
1278 }
1279 if (test21() != 0)
1280 {
1281 cout << "Tracer test (test21) failed" << endl;
1282 exit(1);
1283 }
1284 if (test22() != 0)
1285 {
1286 cout << "Tracer test (test22) failed" << endl;
1287 exit(1);
1288 }
|
1289 marek 1.28 if (test23() != 0)
1290 {
1291 cout << "Tracer test (test23) failed" << endl;
1292 exit(1);
1293 }
|
1294 sushma.fernandes 1.30 if (test24() != 0)
1295 {
1296 cout << "Tracer test (test24) failed" << endl;
1297 exit(1);
1298 }
1299
1300 if (test25() != 0)
1301 {
1302 cout << "Tracer test (test25) failed" << endl;
1303 exit(1);
1304 }
|
1305 r.kieninger 1.36 if (test26() != 0)
1306 {
1307 cout << "Tracer test (test26) failed" << endl;
1308 exit(1);
1309 }
1310
1311 if (test27() != 0)
1312 {
1313 cout << "Tracer test (test27) failed" << endl;
1314 exit(1);
1315 }
|
1316 sushma.fernandes 1.30
|
1317 thilo.boehm 1.39 if (testMemoryHandler(FILE5) != 0)
1318 {
1319 cout << "Tracer test (testMemoryHandler) failed" << endl;
1320 exit(1);
1321 }
1322
1323
|
1324 karl 1.7 cout << argv[0] << " +++++ passed all tests" << endl;
|
1325 mike 1.2 System::removeFile(FILE1);
1326 System::removeFile(FILE2);
1327 System::removeFile(FILE3);
|
1328 kumpf 1.4 System::removeFile(FILE4);
|
1329 thilo.boehm 1.39 System::removeFile(FILE5);
|
1330 mike 1.2 return 0;
1331 #endif
1332 }
|