diff --git a/mozilla/security/nss/cmd/libpkix/pkix/store/test_store.c b/mozilla/security/nss/cmd/libpkix/pkix/store/test_store.c index 99c039a537d..69a44238c18 100755 --- a/mozilla/security/nss/cmd/libpkix/pkix/store/test_store.c +++ b/mozilla/security/nss/cmd/libpkix/pkix/store/test_store.c @@ -86,6 +86,31 @@ PKIX_Error *testCertContinue( return (0); } +static char *catDirName(char *platform, char *dir, void *plContext) +{ + char *pathName = NULL; + PKIX_UInt32 dirLen; + PKIX_UInt32 platformLen; + + PKIX_TEST_STD_VARS(); + + dirLen = PL_strlen(dir); + platformLen = PL_strlen(platform); + + PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Malloc + (platformLen + dirLen + 2, (void **)&pathName, plContext)); + + PL_strcpy(pathName, platform); + PL_strcat(pathName, "/"); + PL_strcat(pathName, dir); + +cleanup: + + PKIX_TEST_RETURN(); + + return (pathName); +} + void testCertStore(char *crlDir) { PKIX_PL_String *dirString = NULL; @@ -152,22 +177,22 @@ cleanup: void printUsage(char *pName){ - printf("\nUSAGE: %s \n\n", pName); + printf("\nUSAGE: %s testName \n\n", pName); } /* Functional tests for CertStore public functions */ int main(int argc, char *argv[]) { - char *crlDir = NULL; + char *platformDir = NULL; + char *dataDir = NULL; + char *combinedDir = NULL; PKIX_UInt32 actualMinorVersion; PKIX_Boolean useArenas = PKIX_FALSE; PKIX_UInt32 j = 0; PKIX_TEST_STD_VARS(); - startTests("CertStore"); - useArenas = PKIX_TEST_ARENAS_ARG(argv[1]); PKIX_TEST_EXPECT_NO_ERROR(PKIX_Initialize @@ -179,18 +204,24 @@ int main(int argc, char *argv[]) { &actualMinorVersion, &plContext)); - if (argc < 2){ + if (argc < (3 + j)) { printUsage(argv[0]); return (0); } - crlDir = argv[j+1]; + startTests(argv[1 + j]); - testCertStore(crlDir); + dataDir = argv[2 + j]; + platformDir = argv[3 + j]; + combinedDir = catDirName(platformDir, dataDir, plContext); + + testCertStore(combinedDir); cleanup: + pkixTestErrorResult = PKIX_PL_Free(combinedDir, plContext); + PKIX_Shutdown(plContext); PKIX_TEST_RETURN(); diff --git a/mozilla/security/nss/cmd/libpkix/pkix_pl/module/colcertstore/test_colcertstore.c b/mozilla/security/nss/cmd/libpkix/pkix_pl/module/colcertstore/test_colcertstore.c index d1cd158d883..cf43df9b0f8 100755 --- a/mozilla/security/nss/cmd/libpkix/pkix_pl/module/colcertstore/test_colcertstore.c +++ b/mozilla/security/nss/cmd/libpkix/pkix_pl/module/colcertstore/test_colcertstore.c @@ -85,6 +85,30 @@ getCertCallback( return (0); } +static char *catDirName(char *platform, char *dir, void *plContext) +{ + char *pathName = NULL; + PKIX_UInt32 dirLen; + PKIX_UInt32 platformLen; + + PKIX_TEST_STD_VARS(); + + dirLen = PL_strlen(dir); + platformLen = PL_strlen(platform); + + PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Malloc + (platformLen + dirLen + 2, (void **)&pathName, plContext)); + + PL_strcpy(pathName, platform); + PL_strcat(pathName, "/"); + PL_strcat(pathName, dir); + +cleanup: + + PKIX_TEST_RETURN(); + + return (pathName); +} void testGetCRL(char *crlDir) { @@ -213,7 +237,7 @@ cleanup: } void printUsage(char *pName){ - printf("\nUSAGE: %s test-purpose \n\n", pName); + printf("\nUSAGE: %s test-purpose \n\n", pName); } /* Functional tests for CollectionCertStore public functions */ @@ -223,8 +247,9 @@ int main(int argc, char *argv[]) { PKIX_UInt32 actualMinorVersion; PKIX_Boolean useArenas = PKIX_FALSE; PKIX_UInt32 j = 0; + char *platformDir = NULL; char *dataDir = NULL; - + char *combinedDir = NULL; PKIX_TEST_STD_VARS(); @@ -233,26 +258,30 @@ int main(int argc, char *argv[]) { useArenas = PKIX_TEST_ARENAS_ARG(argv[1]); PKIX_TEST_EXPECT_NO_ERROR(PKIX_Initialize - (PKIX_TRUE, /* nssInitNeeded */ - useArenas, - PKIX_MAJOR_VERSION, - PKIX_MINOR_VERSION, - PKIX_MINOR_VERSION, - &actualMinorVersion, - &plContext)); + (PKIX_TRUE, /* nssInitNeeded */ + useArenas, + PKIX_MAJOR_VERSION, + PKIX_MINOR_VERSION, + PKIX_MINOR_VERSION, + &actualMinorVersion, + &plContext)); - if (argc < 3+j) { + if (argc < (3 + j)) { printUsage(argv[0]); return (0); } - dataDir = argv[j+2]; + dataDir = argv[2 + j]; + platformDir = argv[3 + j]; + combinedDir = catDirName(platformDir, dataDir, plContext); - testGetCRL(dataDir); - testGetCert(dataDir); + testGetCRL(combinedDir); + testGetCert(combinedDir); cleanup: + pkixTestErrorResult = PKIX_PL_Free(combinedDir, plContext); + PKIX_Shutdown(plContext); PKIX_TEST_RETURN(); diff --git a/mozilla/security/nss/cmd/libpkix/pkix_pl/pki/nameconstraints/test_nameconstraints.c b/mozilla/security/nss/cmd/libpkix/pkix_pl/pki/nameconstraints/test_nameconstraints.c index 28104cb7d85..c283e9558d8 100755 --- a/mozilla/security/nss/cmd/libpkix/pkix_pl/pki/nameconstraints/test_nameconstraints.c +++ b/mozilla/security/nss/cmd/libpkix/pkix_pl/pki/nameconstraints/test_nameconstraints.c @@ -46,6 +46,31 @@ void *plContext = NULL; +static char *catDirName(char *platform, char *dir, void *plContext) +{ + char *pathName = NULL; + PKIX_UInt32 dirLen; + PKIX_UInt32 platformLen; + + PKIX_TEST_STD_VARS(); + + dirLen = PL_strlen(dir); + platformLen = PL_strlen(platform); + + PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Malloc + (platformLen + dirLen + 2, (void **)&pathName, plContext)); + + PL_strcpy(pathName, platform); + PL_strcat(pathName, "/"); + PL_strcat(pathName, dir); + +cleanup: + + PKIX_TEST_RETURN(); + + return (pathName); +} + static void testNameConstraints(char *dataDir) { @@ -83,7 +108,9 @@ cleanup: } void printUsage(void) { - (void) printf("\nUSAGE:\ttest_nameconstraints \n\n"); + (void) printf + ("\nUSAGE:\ttest_nameconstraints " + " \n\n"); } /* Functional tests for CRL public functions */ @@ -91,7 +118,9 @@ void printUsage(void) { int main(int argc, char *argv[]) { PKIX_UInt32 actualMinorVersion; PKIX_UInt32 j = 0; + char *platformDir = NULL; char *dataDir = NULL; + char *combinedDir = NULL; PKIX_Boolean useArenas = PKIX_FALSE; /* Note XXX serialnumber and reasoncode need debug */ @@ -103,25 +132,29 @@ int main(int argc, char *argv[]) { useArenas = PKIX_TEST_ARENAS_ARG(argv[1]); PKIX_TEST_EXPECT_NO_ERROR(PKIX_Initialize - (PKIX_TRUE, /* nssInitNeeded */ - useArenas, - PKIX_MAJOR_VERSION, - PKIX_MINOR_VERSION, - PKIX_MINOR_VERSION, - &actualMinorVersion, - &plContext)); + (PKIX_TRUE, /* nssInitNeeded */ + useArenas, + PKIX_MAJOR_VERSION, + PKIX_MINOR_VERSION, + PKIX_MINOR_VERSION, + &actualMinorVersion, + &plContext)); - if (argc < 2+j) { + if (argc < 3 + j) { printUsage(); return (0); } - dataDir = argv[2+j]; + dataDir = argv[2 + j]; + platformDir = argv[3 + j]; + combinedDir = catDirName(platformDir, dataDir, plContext); - testNameConstraints(dataDir); + testNameConstraints(combinedDir); cleanup: + pkixTestErrorResult = PKIX_PL_Free(combinedDir, plContext); + PKIX_Shutdown(plContext); PKIX_TEST_RETURN(); diff --git a/mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/runPLTests.sh b/mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/runPLTests.sh index b3eabee32c3..a5c4cf9f386 100755 --- a/mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/runPLTests.sh +++ b/mozilla/security/nss/tests/libpkix/pkix_pl_tests/module/runPLTests.sh @@ -104,7 +104,7 @@ SOCKETTRACE=0 export SOCKETTRACE RunTests <