X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=installcheck%2FAmanda_Tapelist.pl;h=af0ed86a6b1968fd7fb40c49dc8186a2d873fe0b;hb=011a59f5a54864108a16af570a6b287410597cc2;hp=1b8bb0fb6fb77c2474b582791659ec0ef79b5de3;hpb=b116e9366c7b2ea2c2eb53b0a13df4090e176235;p=debian%2Famanda diff --git a/installcheck/Amanda_Tapelist.pl b/installcheck/Amanda_Tapelist.pl index 1b8bb0f..af0ed86 100644 --- a/installcheck/Amanda_Tapelist.pl +++ b/installcheck/Amanda_Tapelist.pl @@ -63,8 +63,8 @@ sub readtapelist { @lines = ( "20071111010002 TESTCONF004 reuse\n", - "20071110010002 TESTCONF003 reuse\n", - "20071109010002 TESTCONF002 reuse #comment 2\n", + "20071110010002 TESTCONF003 reuse BARCODE:BAR-003\n", + "20071109010002 TESTCONF002 reuse BARCODE:BAR-002 #comment 2\n", "20071108010001 TESTCONF001 no-reuse #comment 1\n", ); mktapelist($tapelist, @lines); @@ -75,13 +75,13 @@ $tl_ok = is_deeply($tl, { lockname => $tapelist . ".lock", tles => [ { 'datestamp' => '20071111010002', 'label' => 'TESTCONF004', - 'reuse' => 1, 'position' => 1, 'comment' => undef }, + 'reuse' => 1, 'position' => 1, 'barcode' => undef, 'comment' => undef }, { 'datestamp' => '20071110010002', 'label' => 'TESTCONF003', - 'reuse' => 1, 'position' => 2, 'comment' => undef }, + 'reuse' => 1, 'position' => 2, 'barcode' => 'BAR-003', 'comment' => undef }, { 'datestamp' => '20071109010002', 'label' => 'TESTCONF002', - 'reuse' => 1, 'position' => 3, 'comment' => 'comment 2' }, + 'reuse' => 1, 'position' => 3, 'barcode' => 'BAR-002', 'comment' => 'comment 2' }, { 'datestamp' => '20071108010001', 'label' => 'TESTCONF001', - 'reuse' => '', 'position' => 4, 'comment' => 'comment 1' }, + 'reuse' => '', 'position' => 4, 'barcode' => undef, 'comment' => 'comment 1' }, ] }, "A simple tapelist is parsed correctly"); SKIP: { @@ -95,7 +95,7 @@ SKIP: { is_deeply($tl->lookup_tapelabel('TESTCONF002'), { 'datestamp' => '20071109010002', 'label' => 'TESTCONF002', - 'reuse' => 1, 'position' => 3, 'comment' => 'comment 2' }, + 'reuse' => 1, 'position' => 3, 'barcode' => 'BAR-002', 'comment' => 'comment 2' }, "lookup_tapelabel works"); is_deeply($tl->lookup_tapelabel('TESTCONF009'), undef, @@ -103,7 +103,7 @@ SKIP: { is_deeply($tl->lookup_tapepos(4), { 'datestamp' => '20071108010001', 'label' => 'TESTCONF001', - 'reuse' => '', 'position' => 4, 'comment' => 'comment 1' }, + 'reuse' => '', 'position' => 4, 'barcode' => undef, 'comment' => 'comment 1' }, "lookup_tapepos works"); is_deeply($tl->lookup_tapepos(9), undef, @@ -111,29 +111,29 @@ SKIP: { is_deeply($tl->lookup_tapedate('20071110010002'), { 'datestamp' => '20071110010002', 'label' => 'TESTCONF003', - 'reuse' => 1, 'position' => 2, 'comment' => undef }, + 'reuse' => 1, 'position' => 2, 'barcode' => 'BAR-003', 'comment' => undef }, "lookup_tapedate works"); is_deeply($tl->lookup_tapedate('12345678'), undef, "lookup_tapedate returns undef on an unknown datestamp"); # try some edits - $tl->add_tapelabel("20080112010203", "TESTCONF007", "seven", 1); + $tl->add_tapelabel("20080112010203", "TESTCONF007", "seven", 1, undef, 'BAR-007'); is(scalar @{$tl->{'tles'}}, 5, "add_tapelabel adds a new element to the tapelist"); is_deeply($tl->lookup_tapepos(1), { 'datestamp' => '20080112010203', 'label' => 'TESTCONF007', - 'reuse' => 1, 'position' => 1, 'comment' => 'seven' }, + 'reuse' => 1, 'position' => 1, 'barcode' => 'BAR-007', 'comment' => 'seven' }, ".. lookup_tapepos finds it at the beginning"); is_deeply($tl->lookup_tapelabel("TESTCONF007"), { 'datestamp' => '20080112010203', 'label' => 'TESTCONF007', - 'reuse' => 1, 'position' => 1, 'comment' => 'seven' }, + 'reuse' => 1, 'position' => 1, 'barcode' => 'BAR-007', 'comment' => 'seven' }, ".. lookup_tapelabel finds it"); is_deeply($tl->lookup_tapedate("20080112010203"), { 'datestamp' => '20080112010203', 'label' => 'TESTCONF007', - 'reuse' => 1, 'position' => 1, 'comment' => 'seven' }, + 'reuse' => 1, 'position' => 1, 'barcode' => 'BAR-007', 'comment' => 'seven' }, ".. lookup_tapedate finds it"); # try some edits @@ -142,7 +142,7 @@ SKIP: { is_deeply($tl->lookup_tapelabel("TESTCONF008"), { 'datestamp' => '20080112010204', 'label' => 'TESTCONF008', - 'reuse' => 0, 'position' => 1, 'comment' => 'eight' }, + 'reuse' => 0, 'position' => 1, 'barcode' => undef, 'comment' => 'eight' }, ".. lookup_tapelabel finds it no-reuse"); $tl->remove_tapelabel("TESTCONF008"); @@ -153,7 +153,7 @@ SKIP: { is_deeply($tl->lookup_tapepos(4), # used to be in position 5 { 'datestamp' => '20071108010001', 'label' => 'TESTCONF001', - 'reuse' => '', 'position' => 4, 'comment' => 'comment 1' }, + 'reuse' => '', 'position' => 4, 'barcode' => undef, 'comment' => 'comment 1' }, ".. tape positions are adjusted correctly"); is_deeply($tl->lookup_tapelabel("TESTCONF002"), undef, @@ -194,7 +194,7 @@ is_deeply($tl, { lockname => $tapelist . ".lock", tles => [ { 'datestamp' => '2006123456', 'label' => 'FOO', - 'reuse' => 1, 'position' => 1, 'comment' => undef }, + 'reuse' => 1, 'position' => 1, 'barcode' => undef, 'comment' => undef }, ] }, "Invalid lines are ignored"); # make sure clear_tapelist is empty @@ -209,6 +209,6 @@ is_deeply($tl, { lockname => $tapelist . ".lock", tles => [ { 'datestamp' => '2006123456', 'label' => 'FOO', - 'reuse' => 1, 'position' => 1, 'comment' => undef }, + 'reuse' => 1, 'position' => 1, 'barcode' => undef, 'comment' => undef }, ] }, "reload works");