Mercurial > trustbridge
comparison ui/tests/nsstest.cpp @ 830:344d15e23f6c
Add nss shared db data and use it.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 24 Jul 2014 12:09:28 +0200 |
parents | c262ee333c56 |
children | 317ee9dc4684 |
comparison
equal
deleted
inserted
replaced
829:294d76174102 | 830:344d15e23f6c |
---|---|
93 fakeThunderbirdDir = QDir(fakeHome.path() + "/.thunderbird"); | 93 fakeThunderbirdDir = QDir(fakeHome.path() + "/.thunderbird"); |
94 | 94 |
95 /* Copy the current systems NSSSHARED db in the fake home for benchmark tests */ | 95 /* Copy the current systems NSSSHARED db in the fake home for benchmark tests */ |
96 QDir fakeNSSSharedDir = fakeHome.path() + "/.pki/nssdb"; | 96 QDir fakeNSSSharedDir = fakeHome.path() + "/.pki/nssdb"; |
97 QVERIFY(fakeNSSSharedDir.mkpath(fakeNSSSharedDir.path())); | 97 QVERIFY(fakeNSSSharedDir.mkpath(fakeNSSSharedDir.path())); |
98 qDebug() << "Copying: " << QDir::homePath() + "/.pki/nssdb/cert9.db" << | 98 QVERIFY(QFile::copy(":/nss/pki-nssdb/cert9.db", |
99 " to " << fakeNSSSharedDir.path() + "cert9.db"; | |
100 QVERIFY(QFile::copy(QDir::homePath() + "/.pki/nssdb/cert9.db", | |
101 fakeNSSSharedDir.path() + "cert9.db")); | 99 fakeNSSSharedDir.path() + "cert9.db")); |
102 QVERIFY(QFile::copy(QDir::homePath() + "/.pki/nssdb/key4.db", | 100 QVERIFY(QFile::copy(":/nss/pki-nssdb/key4.db", |
103 fakeNSSSharedDir.path() + "key4.db")); | 101 fakeNSSSharedDir.path() + "key4.db")); |
104 QVERIFY(QFile::copy(QDir::homePath() + "/.pki/nssdb/pkcs11.txt", | 102 QFile pkcs11(":/nss/pki-nssdb/pkcs11.txt"); |
105 fakeNSSSharedDir.path() + "pkcs11.txt")); | 103 pkcs11.open(QIODevice::ReadOnly); |
104 | |
105 QString pkcs11content = pkcs11.readAll(); | |
106 pkcs11.close(); | |
107 pkcs11content.replace("TOREPLACE", fakeNSSSharedDir.path()); | |
108 QFile p11outfile (fakeNSSSharedDir.path() + "pkcs11.txt"); | |
109 p11outfile.open(QIODevice::WriteOnly); | |
110 p11outfile.write(pkcs11content.toUtf8()); | |
111 p11outfile.close(); | |
106 | 112 |
107 QVERIFY(!setenv ("HOME", fakeHome.path().toLocal8Bit().constData(), 1)); | 113 QVERIFY(!setenv ("HOME", fakeHome.path().toLocal8Bit().constData(), 1)); |
108 #else | 114 #else |
109 { | 115 { |
110 char buf[fakeHome.path().toLocal8Bit().size() + 9]; | 116 char buf[fakeHome.path().toLocal8Bit().size() + 9]; |