diff options
author | Leah Neukirchen <leah@vuxu.org> | 2021-06-25 21:24:47 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2021-06-25 21:28:19 +0200 |
commit | 32c82229d93471c25eaaaed5e76704893162a125 (patch) | |
tree | 7f396797c397dac8121fd8742d7eb9aa1cd90b64 /t/treegen | |
parent | ca309754c6aba81be4f290279666a68f75306d70 (diff) | |
download | lr-32c82229d93471c25eaaaed5e76704893162a125.tar.gz lr-32c82229d93471c25eaaaed5e76704893162a125.tar.xz lr-32c82229d93471c25eaaaed5e76704893162a125.zip |
add partial test suite testsuite
Diffstat (limited to 't/treegen')
-rwxr-xr-x | t/treegen | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/t/treegen b/t/treegen new file mode 100755 index 0000000..1b7f0c9 --- /dev/null +++ b/t/treegen @@ -0,0 +1,30 @@ +#!/usr/bin/perl -w +use v5.16; + +use File::Spec; +use File::Path qw(make_path); + +# [fdl] +while (<>) { + if (/^f:(.*?)(?::(\d+))?(?::(\d+))?$/) { + my $path = $1; + my ($_volume, $dir, $_base) = File::Spec->splitpath($path); + my $size = $2 || 0; + my $mode = $3 ? oct($3) : 0644; + + make_path($dir) if $dir; + open(my $out, ">", "$path") or die "can't create $path"; + chmod($mode, $out); + truncate($out, $size); + close($out); + } elsif (/^d:(.*)$/) { + make_path($1, {mode => 0755}); + } elsif (/^l:(.*?):(.*)$/) { + my $target = $1; + my $linkname = $2; + my ($_volume, $dir, $_base) = File::Spec->splitpath($linkname); + + make_path($dir) if $dir; + symlink $target, $linkname; + } +} |