IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4979 for trunk/psLib/test/sys


Ignore:
Timestamp:
Sep 8, 2005, 3:11:23 PM (21 years ago)
Author:
drobbin
Message:

Took xml/parser.h out of MDConfig, added psMessageDestination

Location:
trunk/psLib/test/sys
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/sys/tst_psLogMsg.c

    r4951 r4979  
    1616static psS32 testLogMsg04();
    1717static psS32 testLogMsg05();
     18static psS32 testLogMsg06();
    1819
    1920testDescription tests[] = {
     
    3536                              {
    3637                                  testLogMsg05, 5, "psLogSetDestination()", 0, false
     38                              },
     39                              {
     40                                  testLogMsg06, 6, "psMessageDestination()", 0, false
    3741                              },
    3842                              {
     
    236240    return 0;
    237241}
     242
     243psS32 testLogMsg06()
     244{
     245    psS32 i = 0;
     246    //    FILE* file;
     247    int fd;
     248    //    char line[256];
     249
     250    printf("--------------- psMessageDestination(PS_LOG_NONE) ----------------\n");
     251    psMessageDestination("none");
     252    //    psLogSetDestination(0);
     253    for (i=0;i<10;i++) {
     254        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     255    }
     256
     257    printf("------------- psMessageDestination(PS_LOG_TO_STDERR) -------------\n");
     258    psMessageDestination("dest:stderr");
     259    //    psLogSetDestination(2);
     260    for (i=0;i<10;i++) {
     261        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     262    }
     263
     264    printf("------------- psMessageDestination(PS_LOG_TO_STDOUT) -------------\n");
     265    psMessageDestination("dest:stdout");
     266    //    psLogSetDestination(1);
     267    for (i=0;i<10;i++) {
     268        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     269    }
     270
     271    printf("--------------- psMessageDestination(""file:log2.txt"") ---------------\n");
     272    fd = creat("log2.txt", 0666);
     273    psMessageDestination("file:log2.txt");
     274    //    psLogSetDestination(fd);
     275    for (i=0;i<10;i++) {
     276        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     277    }
     278
     279
     280    psMessageDestination("none");
     281    FILE *file;
     282    char line[257];
     283    //    psMessageDestination(-1);
     284    //    psLogSetDestination(0);
     285    printf("--------------------- The Contents of log2.txt -------------------\n");
     286    file = fopen("log2.txt","r");
     287    while ( fgets(line,256,file) != NULL ) {
     288        printf("%s",line);
     289    }
     290    fclose(file);
     291    close(fd);
     292
     293    int fd2 = creat("/eva/log2.txt", 0666);
     294    printf("--------------- psMessageDestination(""file:/eva/log.txt"") ----------\n");
     295    psMessageDestination("file:/eva/log2.txt");
     296    //    psLogSetDestination(fd2);
     297    for ( i=0;i<10;i++) {
     298        psLogMsg(__func__, i, "Hello World! My level is %d\n", i);
     299    }
     300    close(fd2);
     301
     302    return 0;
     303}
  • trunk/psLib/test/sys/verified/tst_psLogMsg.stderr

    r4547 r4979  
    167167---> TESTPOINT PASSED (psLogMsg{psLogSetDestination()} | tst_psLogMsg.c)
    168168
     169/***************************** TESTPOINT ******************************************\
     170*             TestFile: tst_psLogMsg.c                                             *
     171*            TestPoint: psLogMsg{psMessageDestination()}                           *
     172*             TestType: Positive                                                   *
     173\**********************************************************************************/
     174
     175<DATE><TIME>|<HOST>|A|testLogMsg06
     176    Hello World!  My level is 0
     177<DATE><TIME>|<HOST>|E|testLogMsg06
     178    Hello World!  My level is 1
     179<DATE><TIME>|<HOST>|W|testLogMsg06
     180    Hello World!  My level is 2
     181<DATE><TIME>|<HOST>|I|testLogMsg06
     182    Hello World!  My level is 3
     183
     184---> TESTPOINT PASSED (psLogMsg{psMessageDestination()} | tst_psLogMsg.c)
     185
  • trunk/psLib/test/sys/verified/tst_psLogMsg.stdout

    r4547 r4979  
    2121    Hello World!  My level is 3
    2222--------------- psLogSetDestination(file:/eva/log.txt) ----------
     23--------------- psMessageDestination(PS_LOG_NONE) ----------------
     24------------- psMessageDestination(PS_LOG_TO_STDERR) -------------
     25------------- psMessageDestination(PS_LOG_TO_STDOUT) -------------
     26<DATE><TIME>|<HOST>|A|testLogMsg06
     27    Hello World!  My level is 0
     28<DATE><TIME>|<HOST>|E|testLogMsg06
     29    Hello World!  My level is 1
     30<DATE><TIME>|<HOST>|W|testLogMsg06
     31    Hello World!  My level is 2
     32<DATE><TIME>|<HOST>|I|testLogMsg06
     33    Hello World!  My level is 3
     34--------------- psMessageDestination(file:log2.txt) ---------------
     35--------------------- The Contents of log2.txt -------------------
     36<DATE><TIME>|<HOST>|A|testLogMsg06
     37    Hello World!  My level is 0
     38<DATE><TIME>|<HOST>|E|testLogMsg06
     39    Hello World!  My level is 1
     40<DATE><TIME>|<HOST>|W|testLogMsg06
     41    Hello World!  My level is 2
     42<DATE><TIME>|<HOST>|I|testLogMsg06
     43    Hello World!  My level is 3
     44--------------- psMessageDestination(file:/eva/log.txt) ----------
Note: See TracChangeset for help on using the changeset viewer.