Changeset 13979
- Timestamp:
- Feb 6, 2013, 5:51:51 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/move-test.c
r13916 r13979 162 162 ***/ 163 163 164 static int 165 test_set_location (void) 166 { 167 size_t i; 168 int state; 169 char * target_dir; 170 tr_torrent * tor; 171 tr_session * session; 172 const time_t deadline = time(NULL) + 5; 173 174 /* init the session */ 175 session = libttest_session_init (NULL); 176 target_dir = tr_buildPath (tr_sessionGetConfigDir (session), "target", NULL); 177 tr_mkdirp (target_dir, 0777); 178 179 /* init a torrent. */ 180 tor = libttest_zero_torrent_init (session); 181 libttest_zero_torrent_populate (tor, true); 182 libttest_blockingTorrentVerify (tor); 183 check_int_eq (0, tr_torrentStat(tor)->leftUntilDone); 184 185 /* now move it */ 186 state = -1; 187 tr_torrentSetLocation (tor, target_dir, true, NULL, &state); 188 while ((state==TR_LOC_MOVING) && (time(NULL)<=deadline)) 189 tr_wait_msec (50); 190 check_int_eq (TR_LOC_DONE, state); 191 192 /* confirm the torrent is still complete after being moved */ 193 libttest_blockingTorrentVerify (tor); 194 check_int_eq (0, tr_torrentStat(tor)->leftUntilDone); 195 196 /* confirm the filest really got moved */ 197 sync (); 198 for (i=0; i<tor->info.fileCount; ++i) 199 check_file_location (tor, i, tr_buildPath (target_dir, tor->info.files[i].name, NULL)); 200 201 /* cleanup */ 202 tr_free (target_dir); 203 tr_torrentRemove (tor, true, remove); 204 libttest_session_close (session); 205 return 0; 206 } 207 208 /*** 209 **** 210 ***/ 211 164 212 int 165 213 main (void) 166 214 { 167 const testFunc tests[] = { test_incomplete_dir }; 215 const testFunc tests[] = { test_incomplete_dir, 216 test_set_location }; 168 217 169 218 return runTests (tests, NUM_TESTS (tests));
Note: See TracChangeset
for help on using the changeset viewer.