| 1005 | | { |
| 1006 | | Timers::Init(); |
| 1007 | | BackupDaemon bbackupd; |
| 1008 | | bbackupd.Configure("testfiles/bbackupd.conf"); |
| 1009 | | bbackupd.InitCrypto(); |
| 1010 | | |
| 1011 | | fd = open("testfiles/TestDir1/spacetest/f1", O_WRONLY); |
| 1012 | | TEST_THAT(fd > 0); |
| 1013 | | // write again, to update the file's timestamp |
| 1014 | | TEST_EQUAL(1, write(fd, "z", 1), "Buffer write"); |
| 1015 | | TEST_THAT(close(fd) == 0); |
| 1016 | | |
| 1017 | | // wait long enough to put file into sync window |
| 1018 | | wait_for_operation(5); |
| 1019 | | |
| 1020 | | bbackupd.RunSyncNow(); |
| 1021 | | TEST_THAT(intercept_triggered()); |
| 1022 | | intercept_clear_setup(); |
| 1023 | | Timers::Cleanup(); |
| 1024 | | } |
| | 1005 | pid = start_internal_daemon(); |
| | 1006 | intercept_clear_setup(); |
| | 1007 | |
| | 1008 | fd = open("testfiles/TestDir1/spacetest/f1", O_WRONLY); |
| | 1009 | TEST_THAT(fd > 0); |
| | 1010 | // write again, to update the file's timestamp |
| | 1011 | TEST_EQUAL(sizeof(buffer), write(fd, buffer, sizeof(buffer)), |
| | 1012 | "Buffer write"); |
| | 1013 | TEST_THAT(close(fd) == 0); |
| | 1014 | |
| | 1015 | wait_for_backup_operation(); |
| | 1016 | // can't test whether intercept was triggered, because |
| | 1017 | // it's in a different process. |
| | 1018 | // TEST_THAT(intercept_triggered()); |
| | 1019 | TEST_THAT(stop_internal_daemon(pid)); |