Changes to allow bypassing tests for certain machines

From-SVN: r21614
This commit is contained in:
Bruce Korb 1998-08-05 10:20:13 +00:00
parent 7c3b5ba531
commit 725471d2bd
4 changed files with 300 additions and 244 deletions

View File

@ -34,7 +34,7 @@ regex.o: regex.c
-$(CC) -g -DSTDC_HEADERS=1 -c regex.c
fixincl.o : fixincl.x fixincl.c
-$(CC) $(CFLAGS) -o $@ -c fixincl.c
-$(CC) $(CFLAGS) '-DTARGET_MACHINE="$(TARGET)"' -o $@ -c fixincl.c
server.o : server.c server.h
-$(CC) $(CFLAGS) -o $@ -c server.c

View File

@ -73,27 +73,28 @@ struct test_desc
regex_t *pTestRegex;
};
typedef enum
{
PATCH_SED, PATCH_SHELL
}
tePatch;
typedef struct patch_desc tPatchDesc;
#define FD_MACH_ONLY 0x0000
#define FD_MACH_IFNOT 0x0001
#define FD_SKIP_TEST 0x8000
typedef struct fix_desc tFixDesc;
struct fix_desc
{
const char *pzFixName;
const char *pzFileList;
regex_t *pListRegex;
const char* pzFixName; /* Name of the fix */
const char* pzFileList; /* List of files it applies to */
const char** papzMachs; /* List of machine/os-es it applies to */
regex_t* pListRegex;
int testCt;
tTestDesc *pTestDesc;
const char **papzPatchArgs;
int fdFlags;
tTestDesc* pTestDesc;
const char** papzPatchArgs;
};
char *pzDestDir = (char *) NULL;
char *pzSrcDir = (char *) NULL;
char zMachine[] = TARGET_MACHINE;
pid_t chainHead = (pid_t) - 1;
@ -135,7 +136,7 @@ main (argc, argv)
if (strcmp (argv[1], "-v") == 0)
{
fputs ("$Id: fixincl.c,v 1.3 1998/06/02 07:00:12 korbb Exp $\n", stderr);
fputs ("$Id: fixincl.c,v 1.4 1998/08/05 10:20:11 korbb Exp $\n", stderr);
exit (EXIT_SUCCESS);
}
@ -345,11 +346,48 @@ runCompiles ()
/*
* FOR every fixup, ...
*/
for (;;)
do
{
pTD = pFD->pTestDesc;
tstCt = pFD->testCt;
if (pFD->papzMachs != (const char**)NULL) {
const char** papzMachs = pFD->papzMachs;
char* pz = zFileNameBuf;
char* pzSep = "";
tCC* pzIfTrue;
tCC* pzIfFalse;
tSCC zSkip[] = "skip";
tSCC zRun[] = "run";
sprintf( pz, "case %s in\n", zMachine );
pz += strlen( pz );
if (pFD->fdFlags & FD_MACH_IFNOT) {
pzIfTrue = zSkip;
pzIfFalse = zRun;
} else {
pzIfTrue = zRun;
pzIfFalse = zSkip;
}
for (;;) {
const char* pzMach = *(papzMachs++);
if (pzMach == (const char*)NULL)
break;
sprintf( pz, "%s %s", pzSep, pzMach );
pz += strlen( pz );
pzSep = " | \\\n";
}
sprintf( pz, " )\n echo %s ;;\n * )\n echo %s ;;\nesac",
pzIfTrue, pzIfFalse );
pz = runShell( zFileNameBuf );
if (*pz == 's') {
pFD->fdFlags |= FD_SKIP_TEST;
continue;
}
}
/*
* FOR every test for the fixup, ...
*/
@ -378,11 +416,8 @@ runCompiles ()
}
pTD++;
}
if (--fixCt <= 0)
break;
pFD++;
}
while (pFD++, --fixCt > 0);
}
@ -600,6 +635,9 @@ process (pzDta, pzDir, pzFile)
int tstCt;
tSuccess egrepRes;
if (pFD->fdFlags & FD_SKIP_TEST)
continue;
/*
* IF there is a file name restriction,
* THEN ensure the current file name matches one in the pattern

View File

@ -33,6 +33,20 @@ tSCC z[=hackname _cap=]List[] =[=
_ELSE =]
#define z[=hackname _cap=]List (char*)NULL[=
_ENDIF "files _exist" =]
/*
* Machine/OS name selection pattern
*/[=
_IF mach _exist=]
tSCC* apz[=hackname _cap=]Machs[] = {[=
_FOR mach =]
[=mach _str=],[=
/mach=]
(const char*)NULL };[=
_ELSE =]
#define apz[=hackname _cap=]Machs (const char**)NULL[=
_ENDIF "files _exist" =][=
_IF exesel _exist=]
@ -143,9 +157,13 @@ tFixDesc fixDescList[ [=_eval fix _count =] ] = {[=
_FOR fix ",\n" =]
{ z[=hackname _cap=]Name, z[=hackname _cap=]List, (regex_t*)NULL,
[=hackname _up=]_TEST_CT, a[=hackname _cap=]Tests,
apz[=hackname _cap=]Patch }[=
{ z[=hackname _cap=]Name, z[=hackname _cap=]List,
apz[=hackname _cap=]Machs, (regex_t*)NULL,
[=hackname _up=]_TEST_CT, [=
_IF not_machine _exist =]FD_MACH_IFNOT[=
_ELSE =]FD_MACH_ONLY[=
_ENDIF =],
a[=hackname _cap=]Tests, apz[=hackname _cap=]Patch }[=
/fix=]
};

View File

@ -113,7 +113,7 @@ then
exit 0
fi
echo $MAKE install DESTDIR=`dirname $dest`
$MAKE install DESTDIR=`dirname $dest`
echo $MAKE install DESTDIR=`dirname $dest` TARGET=$machine
$MAKE install DESTDIR=`dirname $dest` TARGET=$machine
exit 1