From 37f109e94d0508abe77fc9374ff21e635218b5d0 Mon Sep 17 00:00:00 2001 From: Andreas Romeyke <art1@andreas-romeyke.de> Date: Fri, 29 Oct 2021 13:34:44 +0200 Subject: [PATCH] - fixed testcases - fixed cmpFilesByIgnoringCRLF_LF() - added cmpBinaries() - replaced windows/linux specific codepaths by an unified codepath in testsuite - Hint: testsuite successfully tested under linux and windows :) --- .../bagit/win_valid_test2_bag/meta/marc21.xml | 4 - .../bagit/win_valid_test3_bag/meta/marc21.xml | 4 - .../bagit/win_valid_test4_bag/meta/marc21.xml | 4 - .../bagit/win_valid_test_bag/meta/marc21.xml | 4 - lib/SLUB/LZA/SIPBuilderBagIt.pm | 1 + t/slubsipbuilderbagit.t | 164 +++++++++++------- 6 files changed, 105 insertions(+), 76 deletions(-) diff --git a/export_dir_kitodo/bagit/win_valid_test2_bag/meta/marc21.xml b/export_dir_kitodo/bagit/win_valid_test2_bag/meta/marc21.xml index 05bf81a..b9f2069 100644 --- a/export_dir_kitodo/bagit/win_valid_test2_bag/meta/marc21.xml +++ b/export_dir_kitodo/bagit/win_valid_test2_bag/meta/marc21.xml @@ -6,7 +6,6 @@ <controlfield tag="005">20200124082033.0</controlfield> <controlfield tag="006">m o | | </controlfield> <controlfield tag="007">cr uuu---uuuuu</controlfield> - <controlfield tag="007">vu uuuuuu</controlfield> <controlfield tag="008">160304s2014 xx ||| | o ||ger c</controlfield> <datafield tag="035" ind1=" " ind2=" "> <subfield code="a">(DE-627)1655506501</subfield> @@ -76,9 +75,6 @@ <datafield tag="500" ind1=" " ind2=" "> <subfield code="a">Dokumentarfilm. Deutschland. 2014</subfield> </datafield> - <datafield tag="591" ind1=" " ind2=" "> - <subfield code="a">Fernsehmitschnitt (SWB)</subfield> - </datafield> <datafield tag="655" ind1=" " ind2="7"> <subfield code="a">Film</subfield> <subfield code="0">(DE-588)4017102-4</subfield> diff --git a/export_dir_kitodo/bagit/win_valid_test3_bag/meta/marc21.xml b/export_dir_kitodo/bagit/win_valid_test3_bag/meta/marc21.xml index 05bf81a..b9f2069 100644 --- a/export_dir_kitodo/bagit/win_valid_test3_bag/meta/marc21.xml +++ b/export_dir_kitodo/bagit/win_valid_test3_bag/meta/marc21.xml @@ -6,7 +6,6 @@ <controlfield tag="005">20200124082033.0</controlfield> <controlfield tag="006">m o | | </controlfield> <controlfield tag="007">cr uuu---uuuuu</controlfield> - <controlfield tag="007">vu uuuuuu</controlfield> <controlfield tag="008">160304s2014 xx ||| | o ||ger c</controlfield> <datafield tag="035" ind1=" " ind2=" "> <subfield code="a">(DE-627)1655506501</subfield> @@ -76,9 +75,6 @@ <datafield tag="500" ind1=" " ind2=" "> <subfield code="a">Dokumentarfilm. Deutschland. 2014</subfield> </datafield> - <datafield tag="591" ind1=" " ind2=" "> - <subfield code="a">Fernsehmitschnitt (SWB)</subfield> - </datafield> <datafield tag="655" ind1=" " ind2="7"> <subfield code="a">Film</subfield> <subfield code="0">(DE-588)4017102-4</subfield> diff --git a/export_dir_kitodo/bagit/win_valid_test4_bag/meta/marc21.xml b/export_dir_kitodo/bagit/win_valid_test4_bag/meta/marc21.xml index 05bf81a..b9f2069 100644 --- a/export_dir_kitodo/bagit/win_valid_test4_bag/meta/marc21.xml +++ b/export_dir_kitodo/bagit/win_valid_test4_bag/meta/marc21.xml @@ -6,7 +6,6 @@ <controlfield tag="005">20200124082033.0</controlfield> <controlfield tag="006">m o | | </controlfield> <controlfield tag="007">cr uuu---uuuuu</controlfield> - <controlfield tag="007">vu uuuuuu</controlfield> <controlfield tag="008">160304s2014 xx ||| | o ||ger c</controlfield> <datafield tag="035" ind1=" " ind2=" "> <subfield code="a">(DE-627)1655506501</subfield> @@ -76,9 +75,6 @@ <datafield tag="500" ind1=" " ind2=" "> <subfield code="a">Dokumentarfilm. Deutschland. 2014</subfield> </datafield> - <datafield tag="591" ind1=" " ind2=" "> - <subfield code="a">Fernsehmitschnitt (SWB)</subfield> - </datafield> <datafield tag="655" ind1=" " ind2="7"> <subfield code="a">Film</subfield> <subfield code="0">(DE-588)4017102-4</subfield> diff --git a/export_dir_kitodo/bagit/win_valid_test_bag/meta/marc21.xml b/export_dir_kitodo/bagit/win_valid_test_bag/meta/marc21.xml index 05bf81a..b9f2069 100644 --- a/export_dir_kitodo/bagit/win_valid_test_bag/meta/marc21.xml +++ b/export_dir_kitodo/bagit/win_valid_test_bag/meta/marc21.xml @@ -6,7 +6,6 @@ <controlfield tag="005">20200124082033.0</controlfield> <controlfield tag="006">m o | | </controlfield> <controlfield tag="007">cr uuu---uuuuu</controlfield> - <controlfield tag="007">vu uuuuuu</controlfield> <controlfield tag="008">160304s2014 xx ||| | o ||ger c</controlfield> <datafield tag="035" ind1=" " ind2=" "> <subfield code="a">(DE-627)1655506501</subfield> @@ -76,9 +75,6 @@ <datafield tag="500" ind1=" " ind2=" "> <subfield code="a">Dokumentarfilm. Deutschland. 2014</subfield> </datafield> - <datafield tag="591" ind1=" " ind2=" "> - <subfield code="a">Fernsehmitschnitt (SWB)</subfield> - </datafield> <datafield tag="655" ind1=" " ind2="7"> <subfield code="a">Film</subfield> <subfield code="0">(DE-588)4017102-4</subfield> diff --git a/lib/SLUB/LZA/SIPBuilderBagIt.pm b/lib/SLUB/LZA/SIPBuilderBagIt.pm index 9cb62f7..40b42bf 100644 --- a/lib/SLUB/LZA/SIPBuilderBagIt.pm +++ b/lib/SLUB/LZA/SIPBuilderBagIt.pm @@ -332,6 +332,7 @@ sub buildBagWithMoveOption($ppn,$noppn,$ieDirectory,$rightsFilePath,$aRefAddMeta SLUB::LZA::SIPBuilderBagIt::createDir($bagPath); # move payloads to data dir (which is automatically renamed from IE Directory) print_scalar_data( "INFO: moving original data...", "white"); + say "move from $ieDirectory to $dataPath"; dirmove($ieDirectory, $dataPath) || die ("Error moving $ieDirectory to $dataPath"); __buildBag($ppn,$noppn,$rightsFilePath,$aRefAddMetaFile,$refAddBagInfo,$bagPath,$metaPath); return 1; diff --git a/t/slubsipbuilderbagit.t b/t/slubsipbuilderbagit.t index e95b03d..389dd33 100644 --- a/t/slubsipbuilderbagit.t +++ b/t/slubsipbuilderbagit.t @@ -22,9 +22,8 @@ use strict; use warnings; -use diagnostics; -use Test::More tests => 98; +use Test::More tests => 107; use Test::Output; use Test::Exception; use Test::Differences; @@ -93,14 +92,42 @@ sub cmpFilesByIgnoringCRLF_LF($$$){ my @context = caller; my $content1 = path($file_path1)->slurp; my $content2 = path($file_path2)->slurp; - $content1=~s/(?=n)//; - $content2=~s/(?=n)//; + $content1=~s/\r(?=\n)//g; + $content2=~s/\r(?=\n)//g; unified_diff; eq_or_diff_data( $content1, $content2, $testname, { context=> 3, }) || diag "testcase at $context[1] line $context[2], with file1=$file_path1 file2=$file_path2\n\n"; return; } -### prepare +sub cmpBinaries($$$) { + my $file_path1 = $_[0]; + my $file_path2 = $_[1]; + my $testname = $_[2]; + my @context = caller; + my $diag_cb = sub { + diag "testcase at $context[1] line $context[2], with file1=$file_path1 file2=$file_path2, ".join(" ", @_)."\n\n"; + }; + my $content1; + my $content2; + eval { + $content1 = path($file_path1)->slurp; + $content2 = path($file_path2)->slurp; + }; + if ($@) { + fail $testname; + &$diag_cb($@); + } else { + if ( $content1 eq $content2 ) { pass $testname;} + else { + fail $testname; + &$diag_cb(); + } + } + + return; +} + +## prepare BEGIN { use Path::Tiny; push @INC, Path::Tiny::path(__FILE__)->parent->parent->path("bin")->absolute->stringify; @@ -249,18 +276,18 @@ is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($input_rights . "/Fallbeispiel- is(SLUB::LZA::SIPBuilderBagIt::validateRightsXML($input_rightsFilePath, $xsdName), 1, "validateRightsXML() meta/rights.xml according to $xsdName"); throws_ok{ SLUB::LZA::SIPBuilderBagIt::validateRightsXML($input_metaPath . "/marc21.xml", $xsdName); } qr/failed validation/, "validateRightsXML(\$rightsFilePath, \$xsdName), rights.xml is not valid according to $xsdName"; # -my $system_prefix = 'lin_'; -if($^O eq 'MSWin32'){ $system_prefix = 'win_'; } + my $ie = 'test'; my $bag = 'test_bag'; -my $valid_bag = $system_prefix . 'valid_test_bag'; +my $valid_bag_linux = 'lin_valid_test_bag'; +my $valid_bag_windows = 'win_valid_test_bag'; my @addMetaFile = (); my $ie_input_path = $input_path . '/' . $ie; my $bag_output_path = $output_path . '/' . $bag; my $data_output_path = $bag_output_path . '/data'; my $meta_output_path = $bag_output_path . '/meta'; -my $valid_bag_path = $input_path . '/' . $valid_bag; - +my $valid_bag_linux_path = $input_path . '/' . $valid_bag_linux; +my $valid_bag_windows_path=$input_path . '/' . $valid_bag_windows; SLUB::LZA::SIPBuilderBagIt::createDir($bag_output_path); SLUB::LZA::SIPBuilderBagIt::createDir($data_output_path); File::Copy::Recursive::dircopy($ie_input_path, $data_output_path) or die "Could not perform dircopy() of $ie_input_path to autogenerated $data_output_path: $!"; @@ -278,27 +305,31 @@ workaroundTagmanifest($bag_output_path . '/tagmanifest-md5.txt', 'xxxxxxxxxxxxxx workaroundTagmanifest($bag_output_path . '/tagmanifest-sha512.txt', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'bag-info.txt'); # equalFilesByIgnoring() our testroutine to check paths -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/data/00000001.tif', $valid_bag_path . '/data/00000001.tif', "create_slub_bagit() $bag: validate data/00000001.tif"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); +cmpBinaries($bag_output_path . '/data/00000001.tif', $valid_bag_linux_path . '/data/00000001.tif', "create_slub_bagit() $bag: validate data/00000001.tif"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_linux_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/manifest-md5.txt', $valid_bag_path . '/manifest-md5.txt', "create_slub_bagit() $bag: manifest-md5.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/manifest-sha512.txt', $valid_bag_path . '/manifest-sha512.txt', "create_slub_bagit() $bag: manifest-sha512.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/tagmanifest-md5.txt', $valid_bag_path . '/tagmanifest-md5.txt', "create_slub_bagit() $bag: tagmanifest-md5.txt"); # workaround -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/tagmanifest-sha512.txt', $valid_bag_path . '/tagmanifest-sha512.txt', "create_slub_bagit() $bag: tagmanifest-sha512.txt"); # workaround +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_linux_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_linux_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_linux_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); +# +cmpBinaries($bag_output_path . '/data/00000001.tif', $valid_bag_windows_path . '/data/00000001.tif', "create_slub_bagit() $bag: validate data/00000001.tif"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_windows_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); + +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_windows_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_windows_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_windows_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); # $ie = 'test2'; $bag = 'test2_bag'; -$valid_bag = $system_prefix .'valid_test2_bag'; +$valid_bag_linux = 'lin_valid_test2_bag'; +$valid_bag_windows = 'win_valid_test2_bag'; $ie_input_path = $input_path . '/' . $ie; $bag_output_path = $output_path . '/' . $bag; $data_output_path = $bag_output_path . '/data'; $meta_output_path = $bag_output_path . '/meta'; -$valid_bag_path = $input_path . '/' . $valid_bag; - +$valid_bag_linux_path = $input_path . '/' . $valid_bag_linux; +$valid_bag_windows_path = $input_path . '/' . $valid_bag_windows; ok(SLUB::LZA::SIPBuilderBagIt::buildBagWithCopyOption($ppn, $noppn, $ie_input_path, $input_rightsFilePath, \@addMetaFile, \@addBagInfo, $bag_output_path, $data_output_path, $meta_output_path), "buildBagWithCopyOption()"); # workaround bag-info.txt, tagmanifest-md5.txt, tagmanifest-sha512.txt @@ -307,26 +338,32 @@ workaroundTagmanifest($bag_output_path . '/tagmanifest-md5.txt', 'xxxxxxxxxxxxxx workaroundTagmanifest($bag_output_path . '/tagmanifest-sha512.txt', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'bag-info.txt'); # equalFilesByIgnoring() our testroutine to check paths -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/data/scans_tif/00000001.tif', $valid_bag_path . '/data/scans_tif/00000001.tif', "create_slub_bagit() $bag: validate data/scans_tif/00000001.tif"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/data/scans_tif/00000002.tif', $valid_bag_path . '/data/scans_tif/00000002.tif', "create_slub_bagit() $bag: validate data/scans_tif/00000002.tif"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/data/test.tiff', $valid_bag_path . '/data/test.tiff', "create_slub_bagit() $bag: validate data/test.tiff"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/manifest-md5.txt', $valid_bag_path . '/manifest-md5.txt', "create_slub_bagit() $bag: manifest-md5.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/manifest-sha512.txt', $valid_bag_path . '/manifest-sha512.txt', "create_slub_bagit() $bag: manifest-sha512.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/tagmanifest-md5.txt', $valid_bag_path . '/tagmanifest-md5.txt', "create_slub_bagit() $bag: tagmanifest-md5.txt"); # workaround -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/tagmanifest-sha512.txt', $valid_bag_path . '/tagmanifest-sha512.txt', "create_slub_bagit() $bag: tagmanifest-sha512.txt"); # workaround +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/data/scans_tif/00000001.tif', $valid_bag_linux_path . '/data/scans_tif/00000001.tif', "create_slub_bagit() $bag: validate data/scans_tif/00000001.tif"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/data/scans_tif/00000002.tif', $valid_bag_linux_path . '/data/scans_tif/00000002.tif', "create_slub_bagit() $bag: validate data/scans_tif/00000002.tif"); +cmpBinaries($bag_output_path . '/data/test.tiff', $valid_bag_linux_path . '/data/test.tiff', "create_slub_bagit() $bag: validate data/test.tiff"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_linux_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_linux_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_linux_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_linux_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); # +cmpBinaries($bag_output_path . '/data/scans_tif/00000001.tif', $valid_bag_windows_path . '/data/scans_tif/00000001.tif', "create_slub_bagit() $bag: validate data/scans_tif/00000001.tif"); +cmpBinaries($bag_output_path . '/data/scans_tif/00000002.tif', $valid_bag_windows_path . '/data/scans_tif/00000002.tif', "create_slub_bagit() $bag: validate data/scans_tif/00000002.tif"); +cmpBinaries($bag_output_path . '/data/test.tiff', $valid_bag_windows_path . '/data/test.tiff', "create_slub_bagit() $bag: validate data/test.tiff"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_windows_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_windows_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_windows_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_windows_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); + $ie = 'test3'; $bag = 'test3_bag'; -$valid_bag = $system_prefix . 'valid_test3_bag'; +$valid_bag_linux = 'lin_valid_test3_bag'; +$valid_bag_windows = 'win_valid_test3_bag'; $ie_input_path = $input_path . '/' . $ie; $bag_output_path = $output_path . '/' . $bag; $data_output_path = $bag_output_path . '/data'; $meta_output_path = $bag_output_path . '/meta'; -$valid_bag_path = $input_path . '/' . $valid_bag; +$valid_bag_linux_path = $input_path.'/'.$valid_bag_linux; +$valid_bag_windows_path = $input_path . '/' . $valid_bag_windows; my $new_ie_input_path = $tmp_path->child($ie); File::Copy::Recursive::dircopy($ie_input_path, $new_ie_input_path) or die "Could not perform dircopy() of $ie_input_path to autogenerated $new_ie_input_path: $!"; @@ -337,28 +374,32 @@ ok(SLUB::LZA::SIPBuilderBagIt::buildBagWithMoveOption($ppn, $noppn, $new_ie_inpu workaroundBagInfoTXT($bag_output_path . '/bag-info.txt', 'Bagging-Date', 'xxxx-xx-xx'); workaroundTagmanifest($bag_output_path . '/tagmanifest-md5.txt', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'bag-info.txt'); workaroundTagmanifest($bag_output_path . '/tagmanifest-sha512.txt', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'bag-info.txt'); - -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/data/img/scans_tif/00000001.tif', $valid_bag_path . '/data/img/scans_tif/00000001.tif', "create_slub_bagit() $bag: validate data/img/scans_tif/00000001.tif"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/data/img/scans_tif/00000002.tif', $valid_bag_path . '/data/img/scans_tif/00000002.tif', "create_slub_bagit() $bag: validate data/img/scans_tif/00000002.tif"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/data/test.tiff', $valid_bag_path . '/data/test.tiff', "create_slub_bagit() $bag: validate data/test.tiff"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/manifest-md5.txt', $valid_bag_path . '/manifest-md5.txt', "create_slub_bagit() $bag: manifest-md5.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/manifest-sha512.txt', $valid_bag_path . '/manifest-sha512.txt', "create_slub_bagit() $bag: manifest-sha512.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/tagmanifest-md5.txt', $valid_bag_path . '/tagmanifest-md5.txt', "create_slub_bagit() $bag: tagmanifest-md5.txt"); # workaround -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/tagmanifest-sha512.txt', $valid_bag_path . '/tagmanifest-sha512.txt', "create_slub_bagit() $bag: tagmanifest-sha512.txt"); # workaround +cmpBinaries($bag_output_path . '/data/img/scans_tif/00000001.tif', $valid_bag_linux_path . '/data/img/scans_tif/00000001.tif', "create_slub_bagit() $bag: validate data/img/scans_tif/00000001.tif"); +cmpBinaries($bag_output_path . '/data/img/scans_tif/00000002.tif', $valid_bag_linux_path . '/data/img/scans_tif/00000002.tif', "create_slub_bagit() $bag: validate data/img/scans_tif/00000002.tif"); +cmpBinaries($bag_output_path . '/data/test.tiff', $valid_bag_linux_path . '/data/test.tiff', "create_slub_bagit() $bag: validate data/test.tiff"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_linux_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_linux_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_linux_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_linux_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); # +cmpBinaries($bag_output_path . '/data/img/scans_tif/00000001.tif', $valid_bag_windows_path . '/data/img/scans_tif/00000001.tif', "create_slub_bagit() $bag: validate data/img/scans_tif/00000001.tif"); +cmpBinaries($bag_output_path . '/data/img/scans_tif/00000002.tif', $valid_bag_windows_path . '/data/img/scans_tif/00000002.tif', "create_slub_bagit() $bag: validate data/img/scans_tif/00000002.tif"); +cmpBinaries($bag_output_path . '/data/test.tiff', $valid_bag_windows_path . '/data/test.tiff', "create_slub_bagit() $bag: validate data/test.tiff"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_windows_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_windows_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_windows_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_windows_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); + $ie = 'test4'; $bag = 'test4_bag'; -$valid_bag = $system_prefix . 'valid_test4_bag'; +$valid_bag_linux = 'lin_valid_test4_bag'; +$valid_bag_windows = 'win_valid_test4_bag'; $ie_input_path = $input_path . '/' . $ie; $bag_output_path = $output_path . '/' . $bag; $data_output_path = $bag_output_path . '/data'; $meta_output_path = $bag_output_path . '/meta'; -$valid_bag_path = $input_path . '/' . $valid_bag; - +$valid_bag_linux_path = $input_path . '/' . $valid_bag_linux; +$valid_bag_windows_path = $input_path . '/' . $valid_bag_windows; $new_ie_input_path = $output_path . '/' . $ie ; File::Copy::Recursive::dircopy($ie_input_path, $new_ie_input_path) or die "Could not perform dircopy() of $ie_input_path to autogenerated $new_ie_input_path: $!"; @@ -369,15 +410,18 @@ workaroundBagInfoTXT($bag_output_path . '/bag-info.txt', 'Bagging-Date', 'xxxx-x workaroundTagmanifest($bag_output_path . '/tagmanifest-md5.txt', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'bag-info.txt'); workaroundTagmanifest($bag_output_path . '/tagmanifest-sha512.txt', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'bag-info.txt'); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/data/dir_test_äöüÄÖÜß/00000001.tif', $valid_bag_path . '/data/dir_test_äöüÄÖÜß/00000001.tif', "create_slub_bagit() $bag: validate data/dir_test_äöüÄÖÜß/00000001.tif"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/data/test_äöüÄÖÜß.tiff', $valid_bag_path . '/data/test_äöüÄÖÜß.tiff', "create_slub_bagit() $bag: validate data/test_äöüÄÖÜß.tiff"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/manifest-md5.txt', $valid_bag_path . '/manifest-md5.txt', "create_slub_bagit() $bag: manifest-md5.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/manifest-sha512.txt', $valid_bag_path . '/manifest-sha512.txt', "create_slub_bagit() $bag: manifest-sha512.txt"); -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/tagmanifest-md5.txt', $valid_bag_path . '/tagmanifest-md5.txt', "create_slub_bagit() $bag: tagmanifest-md5.txt"); # workaround -cmpFilesByIgnoringCRLF_LF($bag_output_path . '/tagmanifest-sha512.txt', $valid_bag_path . '/tagmanifest-sha512.txt', "create_slub_bagit() $bag: tagmanifest-sha512.txt"); # workaround +cmpBinaries($bag_output_path . '/data/dir_test_äöüÄÖÜß/00000001.tif', $valid_bag_linux_path . '/data/dir_test_äöüÄÖÜß/00000001.tif', "create_slub_bagit() $bag: validate data/dir_test_äöüÄÖÜß/00000001.tif"); +cmpBinaries($bag_output_path . '/data/test_äöüÄÖÜß.tiff', $valid_bag_linux_path . '/data/test_äöüÄÖÜß.tiff', "create_slub_bagit() $bag: validate data/test_äöüÄÖÜß.tiff"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_linux_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_linux_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_linux_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_linux_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); +# +cmpBinaries($bag_output_path . '/data/dir_test_äöüÄÖÜß/00000001.tif', $valid_bag_windows_path . '/data/dir_test_äöüÄÖÜß/00000001.tif', "create_slub_bagit() $bag: validate data/dir_test_äöüÄÖÜß/00000001.tif"); +cmpBinaries($bag_output_path . '/data/test_äöüÄÖÜß.tiff', $valid_bag_windows_path . '/data/test_äöüÄÖÜß.tiff', "create_slub_bagit() $bag: validate data/test_äöüÄÖÜß.tiff"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/marc21.xml', $valid_bag_windows_path . '/meta/marc21.xml', "create_slub_bagit() $bag: validate meta/marc21.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/meta/rights.xml', $valid_bag_windows_path . '/meta/rights.xml', "create_slub_bagit() $bag: validate meta/rights.xml"); +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bag-info.txt', $valid_bag_windows_path . '/bag-info.txt', "create_slub_bagit() $bag: validate bag-info.txt"); # workaround +cmpFilesByIgnoringCRLF_LF($bag_output_path . '/bagit.txt', $valid_bag_windows_path . '/bagit.txt', "create_slub_bagit() $bag: validate bagit.txt"); 1; -- GitLab