Changeset 2216
- Timestamp:
- 03/08/2008 08:09:18 (5 months ago)
- Files:
-
- 1 modified
-
box/trunk/test/bbackupd/testbbackupd.cpp (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/test/bbackupd/testbbackupd.cpp
r2188 r2216 92 92 std::string found_str = _oss2.str(); \ 93 93 \ 94 TEST_THAT(exp_str == found_str); \95 std::string _line = line; \96 \97 94 if(exp_str != found_str) \ 98 95 { \ 96 std::string _line = line; \ 99 97 printf("Expected <%s> but found <%s> in <%s>\n", \ 100 98 exp_str.c_str(), found_str.c_str(), _line.c_str()); \ 99 TEST_FAIL_WITH_MESSAGE(#found " != " #expected " in " line); \ 101 100 } \ 102 101 } … … 1347 1346 } 1348 1347 1348 if (failures > 0) 1349 { 1350 // stop early to make debugging easier 1351 return 1; 1352 } 1353 1354 // ensure time is different to refresh the cache 1355 ::safe_sleep(1); 1356 1349 1357 BOX_TRACE("Restart bbackupd with more exclusions"); 1350 1358 // Start again with a new config that excludes d3 and f2, … … 1358 1366 bbackupd_pid = LaunchServer(cmd, "testfiles/bbackupd.pid"); 1359 1367 TEST_THAT(bbackupd_pid != -1 && bbackupd_pid != 0); 1360 ::safe_sleep(1);1361 1368 TEST_THAT(ServerIsAlive(bbackupd_pid)); 1362 1369 TEST_THAT(ServerIsAlive(bbstored_pid)); … … 1364 1371 if (!ServerIsAlive(bbstored_pid)) return 1; 1365 1372 */ 1373 1366 1374 BackupDaemon bbackupd; 1367 1375 bbackupd.Configure("testfiles/bbackupd-exclude.conf"); … … 1372 1380 // wait_for_sync_end(); 1373 1381 { 1374 Logging::Guard guard(Log::ERROR);1382 // Logging::Guard guard(Log::ERROR); 1375 1383 bbackupd.RunSyncNow(); 1376 1384 } … … 1394 1402 // d7 deleted 1395 1403 // Careful with timing here, these files can already be 1396 // deleted by housekeeping. 1404 // deleted by housekeeping. On Win32, housekeeping runs 1405 // immediately after disconnect, but only if enough time 1406 // has elapsed since the last housekeeping. Since the 1407 // backup run closely follows the last one, housekeeping 1408 // should not run afterwards. By waiting before 1409 // connecting to check the results, we should force 1410 // housekeeping to run after that check, so the next check 1411 // will see that the deleted files have been removed. 1412 1413 #ifdef WIN32 1414 BOX_TRACE("Wait long enough that housekeeping " 1415 "will run again") 1416 wait_for_backup_operation(5); 1417 BOX_TRACE("done."); 1418 #endif 1397 1419 1398 1420 BOX_TRACE("Find out whether bbackupd marked files as deleted"); … … 1418 1440 ReadDirectory(*client, spacetestDirId); 1419 1441 1442 // these files were deleted before, they should be 1443 // long gone by now 1444 1420 1445 TEST_THAT(SearchDir(*spacetest_dir, "f1") == 0); 1446 TEST_THAT(SearchDir(*spacetest_dir, "d7") == 0); 1447 1448 // these files have just been deleted, because 1449 // they are excluded by the new configuration. 1450 // but housekeeping should not have run yet 1421 1451 TEST_THAT(test_entry_deleted(*spacetest_dir, "f2")); 1422 1452 TEST_THAT(test_entry_deleted(*spacetest_dir, "d3")); 1423 TEST_THAT(SearchDir(*spacetest_dir, "d7") == 0);1424 1453 1425 1454 int64_t d3_id = SearchDir(*spacetest_dir, "d3"); … … 1455 1484 BOX_TRACE("done."); 1456 1485 1486 if (failures > 0) 1487 { 1488 // stop early to make debugging easier 1489 return 1; 1490 } 1491 1457 1492 // Wait for housekeeping to run 1458 1493 BOX_TRACE("Wait for housekeeping to remove the deleted files"); … … 1503 1538 } 1504 1539 1540 if (failures > 0) 1541 { 1542 // stop early to make debugging easier 1543 return 1; 1544 } 1545 1505 1546 // Need 22 blocks free to upload everything 1506 1547 TEST_THAT_ABORTONFAIL(::system(BBSTOREACCOUNTS " -c " … … 1547 1588 client->QueryFinished(); 1548 1589 sSocket.Close(); 1590 } 1591 1592 if (failures > 0) 1593 { 1594 // stop early to make debugging easier 1595 return 1; 1549 1596 } 1550 1597 … … 1599 1646 if (!ServerIsAlive(bbackupd_pid)) return 1; 1600 1647 if (!ServerIsAlive(bbstored_pid)) return 1; 1648 1649 if (failures > 0) 1650 { 1651 // stop early to make debugging easier 1652 return 1; 1653 } 1601 1654 } 1602 1655 … … 1623 1676 1624 1677 char buf[PATH_MAX]; 1625 TEST_THAT(getcwd(buf, sizeof(buf)) != NULL);1678 TEST_THAT(getcwd(buf, sizeof(buf)) == buf); 1626 1679 std::string path = buf; 1627 1680 path += DIRECTORY_SEPARATOR SYM_DIR … … 1889 1942 1890 1943 } 1944 1945 int compareReturnValue; 1891 1946 1892 1947 #ifdef WIN32 … … 1931 1986 1932 1987 char cwdbuf[1024]; 1933 TEST_ EQUAL(cwdbuf, getcwd(cwdbuf, sizeof(cwdbuf)), "getcwd");1988 TEST_THAT(getcwd(cwdbuf, sizeof(cwdbuf)) == cwdbuf); 1934 1989 std::string cwd = cwdbuf; 1935 1990 … … 2267 2322 2268 2323 // check that no backup has run (compare fails) 2269 intcompareReturnValue = ::system(BBACKUPQUERY " "2324 compareReturnValue = ::system(BBACKUPQUERY " " 2270 2325 "-Werror " 2271 2326 "-c testfiles/bbackupd.conf " … … 2340 2395 // wait for backup daemon to do it's stuff, and compare again 2341 2396 wait_for_backup_operation(); 2342 intcompareReturnValue = ::system(BBACKUPQUERY " -Wwarning "2397 compareReturnValue = ::system(BBACKUPQUERY " -Wwarning " 2343 2398 "-c testfiles/bbackupd.conf " 2344 2399 "-l testfiles/query2.log "
