Ignore:
Timestamp:
Aug 17, 2000, 10:23:35 AM (25 years ago)
Author:
bird
Message:

Corrected some bugs.
Current known problem is that myldrOpen seems to destroy stack causing
the call to mytkExecPgm not return correctly and hence sysinit not to
release the ldrSem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GRACE/src/win32k/test/win32ktst.c

    r4017 r4025  
    1 /* $Id: win32ktst.c,v 1.1.4.3 2000-08-15 06:16:09 bird Exp $
     1/* $Id: win32ktst.c,v 1.1.4.4 2000-08-17 08:23:35 bird Exp $
    22 *
    33 * Win32k test module.
     
    582582        case 1:     rc = TestCase1(argc, argv);   break;
    583583        case 2:     rc = TestCase2();   break;
     584        case 3:     rc = TestCase3();   break;
    584585
    585586        default:
     
    681682    int         rc = 1;
    682683    RP32INIT    rpinit;
    683     char *      pszInitArgs = "-C1 -L:N -Verbose -Quiet -Elf:Yes -Pe:Mixed -Script:No -W4 -Heap:512000 -ResHeap:0256000 -HeapMax:4096000 -ResHeapMax:0x100000";
     684    char *      pszInitArgs = "-C1 -L:N -Verbose -Quiet -Elf:Yes -Pe:Mixed -Script:Yes -W4 -Heap:512000 -ResHeap:0256000 -HeapMax:4096000 -ResHeapMax:0x100000";
    684685
    685686    /* $elf */
     
    701702            opt.cbResHeapMax    = 0x100000;
    702703            opt.fElf            = TRUE;
    703             opt.fUNIXScript     = FALSE;
     704            opt.fUNIXScript     = TRUE;
    704705            opt.fPE             = FLAGS_PE_MIXED;
    705706            opt.fQuiet          = TRUE;
     
    709710
    710711            rc = CompareOptions(SSToDS(&opt));
     712            if (rc == NO_ERROR)
     713            {
     714                 rc = TestCaseExeLoad2();
     715            }
    711716        }
    712717        else
     
    718723    return rc;
    719724}
     725
     726/**
     727 * Test case 3.
     728 * Checks that all parameters are read correctly (1).
     729 *
     730 * @sketch  Create init packet with no arguments.
     731 *          Initiate elf$
     732 *          Create init packet with no arguments.
     733 *          Initiate win32k$
     734 * @returns 0 on success.
     735 *          1 on failure.
     736 * @status  completely implemented.
     737 * @author  knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
     738 */
     739int TestCase3(void)
     740{
     741    int         rc = 1;
     742    RP32INIT    rpinit;
     743    char *      pszInitArgs = "-C1 -L:N -Verbose -Quiet -Elf:Yes -Pe:PE -Script:Yes -W4 -Heap:512000 -ResHeap:0256000 -HeapMax:4096000 -ResHeapMax:0x100000";
     744
     745    /* $elf */
     746    initRPInit(SSToDS(&rpinit), pszInitArgs);
     747    rc = InitElf(&rpinit);              /* no SSToDS! */
     748    printf("InitElf returned status=0x%04x\n", rpinit.rph.Status);
     749    if ((rpinit.rph.Status & (STDON | STERR)) == STDON)
     750    {
     751        /* $win32k */
     752        initRPInit(SSToDS(&rpinit), pszInitArgs);
     753        rc = InitWin32k(&rpinit);       /* no SSToDS! */
     754        printf("InitWin32k returned status=0x%04x\n", rpinit.rph.Status);
     755        if ((rpinit.rph.Status & (STDON | STERR)) == STDON)
     756        {
     757            struct options opt = DEFAULT_OPTION_ASSIGMENTS;
     758            opt.cbSwpHeapInit   = 512000;
     759            opt.cbSwpHeapMax    = 4096000;
     760            opt.cbResHeapInit   = 0256000;
     761            opt.cbResHeapMax    = 0x100000;
     762            opt.fElf            = TRUE;
     763            opt.fUNIXScript     = TRUE;
     764            opt.fPE             = FLAGS_PE_PE;
     765            opt.fQuiet          = TRUE;
     766            opt.fLogging        = FALSE;
     767            opt.usCom           = OUTPUT_COM1;
     768            opt.ulInfoLevel     = INFOLEVEL_INFOALL;
     769
     770            rc = CompareOptions(SSToDS(&opt));
     771            if (rc == NO_ERROR)
     772            {
     773                 rc = TestCaseExeLoad2();
     774            }
     775        }
     776        else
     777            printf("!failed!\n");
     778    }
     779    else
     780        printf("!failed!\n");
     781
     782    return rc;
     783}
     784
    720785
    721786/**
     
    739804    if (options.fLogging != pOpt->fLogging)
    740805        printf("fLogging = %d - should be %d\n", options.fLogging, pOpt->fLogging, rc++);
    741     if (options.ulBuild != ~0UL)
     806    if (pOpt->ulBuild != ~0UL)
    742807    {
    743808        if (options.fKernel != pOpt->fKernel)
     
    777842
    778843
    779 
    780 
    781844/**
    782845 * Simulates a executable loading (no errors).
     
    804867     * Do the real execution.
    805868     */
    806     printf("--- TestcaseExeLoad1 - loading win32ktst.exe (LX image) ----\n");
     869    printf("--- TestcaseExeLoad3 - loading win32ktst.exe (LX image) ----\n");
    807870    rc = CalltkExecPgm(EXEC_LOAD, NULL, NULL, "win32ktst.exe");
    808871    if (rc == NO_ERROR)
    809872    {
    810873        psz = "BIN\\DEBUG\\LIBCONV.EXE\0";
    811         printf("--- TestcaseExeLoad1 - loading libconv.exe (LX image) ----\n");
     874        printf("--- TestcaseExeLoad3 - loading libconv.exe (LX image) ----\n");
    812875        rc = CalltkExecPgm(EXEC_LOAD, NULL, NULL, "bin\\debug\\libconv.exe");
    813         #if 0 //not implemented by CalltkExecPgm...???
    814         /* check result */
    815         if (memcmp(achTkExecPgmArguments, psz, strlen(psz) + 1) != 0)
     876        if (rc == NO_ERROR)
    816877        {
    817             rc  = ERROR_BAD_ARGUMENTS;
    818             printf("Bad Arguments! (%s)\n", achTkExecPgmArguments);
     878            #if 0 //not implemented by CalltkExecPgm...???
     879            /* check result */
     880            if (memcmp(achTkExecPgmArguments, psz, strlen(psz) + 1) != 0)
     881            {
     882                rc  = ERROR_BAD_ARGUMENTS;
     883                printf("Bad Arguments! (%s)\n", achTkExecPgmArguments);
     884            }
     885            #else
     886            psz = psz;
     887            #endif
    819888        }
    820         #else
    821         psz = psz;
    822         #endif
    823889    }
    824890
     
    826892    {
    827893        psz = "REXX\\TST.CMD\0OriginalArgument1 OriginalArgument2\0OriginalArgument3\0";
    828         printf("--- TestcaseExeLoad1 - loading rexx\\tst.cmd (REXX script) ----\n");
     894        printf("--- TestcaseExeLoad3 - loading rexx\\tst.cmd (REXX script) ----\n");
    829895        rc = CalltkExecPgm(EXEC_LOAD, psz, NULL, "rexx\\tst.cmd");
    830 
    831         /* check result */
    832         psz[strlen(psz)] = ' ';
    833         for (cch = 0; psz[cch] != '\0';)
    834             cch += strlen(psz + cch) + 1;
    835         cch++;
    836         if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0)
     896        if (rc == NO_ERROR)
    837897        {
    838             rc  = ERROR_BAD_ARGUMENTS;
    839             printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1);
     898            /* check result */
     899            psz = "REXX\\TST.CMD OriginalArgument1 OriginalArgument2\0OriginalArgument3\0";
     900            cch = strlen(psz);
     901            if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0)
     902            {
     903                rc  = ERROR_BAD_ARGUMENTS;
     904                printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1);
     905            }
    840906        }
    841907    }
     
    844910    {
    845911        psz = "TEST\\TST.SH\0OrgArg1 OrgArg2\0OrgArg3\0";
    846         printf("--- TestcaseExeLoad1 - loading test\\testscript.sh (UNIX shell script) ----\n");
     912        printf("--- TestcaseExeLoad3 - loading test\\tst.sh (UNIX shell script) ----\n");
    847913        rc = CalltkExecPgm(EXEC_LOAD, psz, NULL, "test\\tst.sh");
    848 
    849         /* check result */
    850         psz[strlen(psz)] = ' ';
    851         for (cch = 0; psz[cch] != '\0';)
    852             cch += strlen(psz + cch) + 1;
    853         cch++;
    854         if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0)
     914        if (rc == NO_ERROR)
    855915        {
    856             rc  = ERROR_BAD_ARGUMENTS;
    857             printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1);
     916            /* check result */
     917            psz = "TEST\\TST.SH OrgArg1 OrgArg2\0OrgArg3\0";
     918            cch = strlen(psz);
     919            if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0)
     920            {
     921                rc  = ERROR_BAD_ARGUMENTS;
     922                printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1);
     923            }
    858924        }
    859925    }
    860926
    861 
    862927    if (rc == NO_ERROR)
    863928    {
    864         printf("--- TestcaseExeLoad1 - loading SOL.EXE (PE image) ----\n");
     929        psz = "TEST\\TST2.SH\0OrgArg1 OrgArg2\0OrgArg3\0";
     930        printf("--- TestcaseExeLoad3 - loading test\\tst2.sh (UNIX shell script) ----\n");
     931        rc = CalltkExecPgm(EXEC_LOAD, psz, NULL, "test\\tst2.sh");
     932        if (rc == NO_ERROR)
     933        {
     934            /* check result */
     935            psz = "-arg1 -arg2 -arg3 TEST\\TST2.SH OrgArg1 OrgArg2\0OrgArg3\0";
     936            cch = strlen(psz) + 1;
     937            if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0)
     938            {
     939                rc  = ERROR_BAD_ARGUMENTS;
     940                printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1);
     941            }
     942        }
     943    }
     944
     945    if (rc == NO_ERROR)
     946    {
     947        printf("--- TestcaseExeLoad3 - loading SOL.EXE (PE image) ----\n");
    865948        rc = CalltkExecPgm(EXEC_LOAD, NULL, NULL, "e:\\Win32Prog\\Sol\\Sol.exe");
     949        if (rc == NO_ERROR)
     950        {
     951            /* check result */
     952            psz = "E:\\WIN32PROG\\SOL\\SOL.EXE\0";
     953            cch = strlen(psz) + 1 + 1;
     954            if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0)
     955            {
     956                rc  = ERROR_BAD_ARGUMENTS;
     957                printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1);
     958            }
     959        }
    866960    }
    867961
     
    871965    return rc;
    872966}
     967
Note: See TracChangeset for help on using the changeset viewer.