~deja-dup-hackers/deja-dup/22

« back to all changes in this revision

Viewing changes to tests/common/common.vala

  • Committer: Michael Terry
  • Date: 2012-01-09 13:36:21 UTC
  • mfrom: (1265.1.3 read-error)
  • Revision ID: michael.terry@canonical.com-20120109133621-9fc30d8ld8cqxths
warn user if we fail to back up a file

Show diffs side-by-side

added added

removed removed

Lines of Context:
207
207
  {
208
208
    var loop = new MainLoop(null);
209
209
    var op = new DejaDup.OperationBackup();
210
 
    op.done.connect((op, s, c) => {
 
210
    op.done.connect((op, s, c, d) => {
 
211
      Test.message("Done: %d, %d, %s", (int)s, (int)c, d);
211
212
      if (success != s)
212
213
        warning("Success didn't match; expected %d, got %d", (int) success, (int) s);
213
214
      if (cancelled != c)
214
215
        warning("Cancel didn't match; expected %d, got %d", (int) cancelled, (int) c);
 
216
      if (detail != d)
 
217
        warning("Detail didn't match; expected %s, got %s", detail, d);
215
218
      loop.quit();
216
219
    });
217
220
 
420
423
  br.run();
421
424
}
422
425
 
 
426
void read_error()
 
427
{
 
428
  Test.bug("907846");
 
429
  var user = Environment.get_user_name();
 
430
  set_script("""
 
431
ARGS: collection-status %s
 
432
 
 
433
=== deja-dup ===
 
434
ARGS: %s
 
435
 
 
436
WARNING 10 '/blarg'
 
437
 
 
438
WARNING 10 '/home/%s/1'
 
439
 
 
440
WARNING 10 '/home/%s/2'
 
441
 
 
442
=== deja-dup ===
 
443
ARGS: %s
 
444
 
 
445
WARNING 10 '/blarg'
 
446
 
 
447
WARNING 10 '/home/%s/1'
 
448
 
 
449
WARNING 10 '/home/%s/2'
 
450
 
 
451
""".printf(default_args(),
 
452
           default_args(Mode.DRY), user, user,
 
453
           default_args(Mode.BACKUP), user, user));
 
454
 
 
455
  var br = new BackupRunner();
 
456
  br.detail = """Could not back up the following files.  Please make sure you are able to open them.
 
457
 
 
458
/home/%s/1
 
459
/home/%s/2""".printf(user, user);
 
460
  br.run();
 
461
}
 
462
 
423
463
int main(string[] args)
424
464
{
425
465
  Test.init(ref args);
445
485
  backup.add(make_backup_case("cancel_noop", cancel_noop));
446
486
  backup.add(make_backup_case("cancel", cancel));
447
487
  backup.add(make_backup_case("stop", stop));
 
488
  backup.add(make_backup_case("read_error", read_error));
448
489
  TestSuite.get_root().add_suite(backup);
449
490
 
450
491
  var rv = Test.run();