comparison ui/tests/nsstest.cpp @ 371:6b78a89c1e17

Fix NSS test in release build and add verify's to avoid segfault with invalid list.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 15 Apr 2014 11:04:34 +0200
parents a54925d41056
children 17e1c8f37d72
comparison
equal deleted inserted replaced
370:8b9ba61add57 371:6b78a89c1e17
60 60
61 void NSSTest::initTestCase() { 61 void NSSTest::initTestCase() {
62 QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); /* use system default */ 62 QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); /* use system default */
63 63
64 /* Set up a temporary list */ 64 /* Set up a temporary list */
65 #ifdef RELEASE_BUILD
66 QFile res(":/list-valid-signed-release.txt");
67 #else
65 QFile res(":/list-valid-signed.txt"); 68 QFile res(":/list-valid-signed.txt");
69 #endif
66 res.open(QIODevice::ReadOnly); 70 res.open(QIODevice::ReadOnly);
67 validListFile.open(); 71 validListFile.open();
68 validListFile.write(res.readAll()); 72 validListFile.write(res.readAll());
69 validListFile.close(); 73 validListFile.close();
70 74
71 setupTestDir(&ffNSSDir); 75 setupTestDir(&ffNSSDir);
72 setupTestDir(&tbNSSDir); 76 setupTestDir(&tbNSSDir);
73 77
74 validList = CertificateList(validListFile.fileName().toLocal8Bit().data()); 78 validList = CertificateList(validListFile.fileName().toLocal8Bit().data());
79
80 QVERIFY(validList.isValid());
75 81
76 /* Create the profiles.ini `s set environment variables*/ 82 /* Create the profiles.ini `s set environment variables*/
77 // fakeHome.setAutoRemove(false); 83 // fakeHome.setAutoRemove(false);
78 #ifndef WIN32 84 #ifndef WIN32
79 QVERIFY(!setenv ("HOME", fakeHome.path().toLocal8Bit().constData(), 1)); 85 QVERIFY(!setenv ("HOME", fakeHome.path().toLocal8Bit().constData(), 1));
132 instList << cert; 138 instList << cert;
133 strv_append (&to_install, cert.base64Line().toLatin1().constData() + 2, 139 strv_append (&to_install, cert.base64Line().toLatin1().constData() + 2,
134 cert.base64Line().size() - 2); 140 cert.base64Line().size() - 2);
135 } 141 }
136 QVERIFY((size_t) instList.size() == strv_length(to_install)); 142 QVERIFY((size_t) instList.size() == strv_length(to_install));
143 QVERIFY(strv_length(to_install) != 0);
137 144
138 QVERIFY(write_stores_nss(to_install, to_remove) == 0); 145 QVERIFY(write_stores_nss(to_install, to_remove) == 0);
139 146
140 { 147 {
141 /* Verify that everything is installed */ 148 /* Verify that everything is installed */

http://wald.intevation.org/projects/trustbridge/