Separate platform paths from relative paths on command lines for libpkix tests,
to eliminate lines too long in html test output. git-svn-id: svn://10.0.0.236/branches/NSS_LIBPKIX_BRANCH@194527 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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 <data-dir>\n\n", pName);
|
||||
printf("\nUSAGE: %s testName <data-dir> <platform-dir>\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();
|
||||
|
||||
@@ -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 <data-dir> \n\n", pName);
|
||||
printf("\nUSAGE: %s test-purpose <data-dir> <platform-dir>\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();
|
||||
|
||||
@@ -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 <test-purpose> <data-dir>\n\n");
|
||||
(void) printf
|
||||
("\nUSAGE:\ttest_nameconstraints <test-purpose>"
|
||||
" <data-dir> <platform-prefix>\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();
|
||||
|
||||
@@ -104,7 +104,7 @@ SOCKETTRACE=0
|
||||
export SOCKETTRACE
|
||||
|
||||
RunTests <<EOF
|
||||
test_colcertstore NIST-Test-Files-Used ${HOSTDIR}/rev_data/local
|
||||
test_colcertstore NIST-Test-Files-Used rev_data/local ${HOSTDIR}
|
||||
test_pk11certstore ../../pkix_pl_tests/module ../../pkix_tests/top/rev_data/crlchecker
|
||||
test_ekuchecker "Test-EKU-without-OID" ENE "" rev_data test_eku_codesigning_clientauth.crt test_eku_clientauth.crt test_eku_clientauthEE.crt
|
||||
test_ekuchecker "Test-EKU-with-good-OID" ENE "1.3.6.1.5.5.7.3.3" rev_data test_eku_codesigning_clientauth.crt test_eku_clientauth.crt test_eku_clientauthEE.crt
|
||||
|
||||
@@ -101,7 +101,7 @@ test_x500name
|
||||
test_generalname
|
||||
test_date NIST-Test-Files-Used
|
||||
test_crlentry ../../certs
|
||||
test_nameconstraints NIST-Test-Files-Used ${HOSTDIR}/rev_data/local
|
||||
test_nameconstraints NIST-Test-Files-Used rev_data/local ${HOSTDIR}
|
||||
test_authorityinfoaccess NIST-PDTest ${NIST_PDTEST} certs/BasicLDAPURIPathDiscoveryOU1EE1.crt certs/BasicHTTPURITrustAnchorRootCert.crt
|
||||
test_subjectinfoaccess NIST-PDTest ${NIST_PDTEST} certs/BasicHTTPURITrustAnchorRootCert.crt certs/BasicLDAPURIPathDiscoveryOU1EE1.crt
|
||||
EOF
|
||||
|
||||
@@ -56,7 +56,7 @@ testunit=STORE
|
||||
ParseArgs $*
|
||||
|
||||
RunTests <<EOF
|
||||
test_store ${HOSTDIR}/rev_data/crlchecker
|
||||
test_store genericCertStore rev_data/crlchecker ${HOSTDIR}
|
||||
EOF
|
||||
|
||||
totalErrors=$?
|
||||
|
||||
Reference in New Issue
Block a user