diff options
Diffstat (limited to 'src/selftest.cpp')
| -rw-r--r-- | src/selftest.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/selftest.cpp b/src/selftest.cpp index 4ba90c3..7d3a96e 100644 --- a/src/selftest.cpp +++ b/src/selftest.cpp | |||
| @@ -1230,6 +1230,41 @@ static int RunWalletSQLiteMigrationSelfTest() | |||
| 1230 | FileContainsText(strVerifyOut, "verification: ok"), | 1230 | FileContainsText(strVerifyOut, "verification: ok"), |
| 1231 | "SQLite wallet export verifies against wallet.dat") ? 0 : 1; | 1231 | "SQLite wallet export verifies against wallet.dat") ? 0 : 1; |
| 1232 | 1232 | ||
| 1233 | string strRestoredDir = tmp + "/restored-wallet"; | ||
| 1234 | nFail += Check(MakeDirLocal(strRestoredDir), | ||
| 1235 | "restored wallet directory can be created") ? 0 : 1; | ||
| 1236 | string strRestoreOut = tmp + "/sqlite-restore.txt"; | ||
| 1237 | vector<string> vRestoreArgs; | ||
| 1238 | vRestoreArgs.push_back("-datadir=" + strRestoredDir); | ||
| 1239 | vRestoreArgs.push_back("-nomanagedtor"); | ||
| 1240 | vRestoreArgs.push_back("-nogui"); | ||
| 1241 | vRestoreArgs.push_back("-walletsqliterestore=" + strSQLite); | ||
| 1242 | int nRestoreRet = RunBitflashChild(strExe, vRestoreArgs, NULL, &strRestoreOut); | ||
| 1243 | nFail += Check(nRestoreRet == 0 && | ||
| 1244 | FileContainsText(strRestoreOut, "records restored:"), | ||
| 1245 | "SQLite wallet export restores into a fresh wallet.dat") ? 0 : 1; | ||
| 1246 | |||
| 1247 | string strVerifyRestoredOut = tmp + "/sqlite-verify-restored.txt"; | ||
| 1248 | vector<string> vVerifyRestoredArgs; | ||
| 1249 | vVerifyRestoredArgs.push_back("-datadir=" + strRestoredDir); | ||
| 1250 | vVerifyRestoredArgs.push_back("-nomanagedtor"); | ||
| 1251 | vVerifyRestoredArgs.push_back("-nogui"); | ||
| 1252 | vVerifyRestoredArgs.push_back("-walletsqliteverify=" + strSQLite); | ||
| 1253 | int nVerifyRestoredRet = | ||
| 1254 | RunBitflashChild(strExe, vVerifyRestoredArgs, NULL, &strVerifyRestoredOut); | ||
| 1255 | nFail += Check(nVerifyRestoredRet == 0 && | ||
| 1256 | FileContainsText(strVerifyRestoredOut, | ||
| 1257 | "verification: ok"), | ||
| 1258 | "restored wallet.dat verifies against the SQLite export") ? 0 : 1; | ||
| 1259 | |||
| 1260 | string strRestoreOverwriteOut = tmp + "/sqlite-restore-overwrite.txt"; | ||
| 1261 | int nRestoreOverwriteRet = | ||
| 1262 | RunBitflashChild(strExe, vRestoreArgs, NULL, &strRestoreOverwriteOut); | ||
| 1263 | nFail += Check(nRestoreOverwriteRet == 1 && | ||
| 1264 | FileContainsText(strRestoreOverwriteOut, | ||
| 1265 | "Refusing to overwrite existing wallet.dat"), | ||
| 1266 | "SQLite wallet restore refuses to overwrite wallet.dat") ? 0 : 1; | ||
| 1267 | |||
| 1233 | string strOverwriteOut = tmp + "/sqlite-export-overwrite.txt"; | 1268 | string strOverwriteOut = tmp + "/sqlite-export-overwrite.txt"; |
| 1234 | int nOverwriteRet = | 1269 | int nOverwriteRet = |
| 1235 | RunBitflashChild(strExe, vExportArgs, NULL, &strOverwriteOut); | 1270 | RunBitflashChild(strExe, vExportArgs, NULL, &strOverwriteOut); |