mirror of
https://codeberg.org/h3xx/simplify_static_dir
synced 2024-08-14 23:57:24 +00:00
22a7b86113
During all this I uncovered a bug in how Archive::Tar handles sparse files stored in tarballs; the library reports the file as having no contents and a size of 0. As a result, in the freed-bytes-commas test, the tarball extraction has been replaced by on-the-fly file creation.
31 lines
696 B
Perl
31 lines
696 B
Perl
#!/usr/bin/perl
|
|
# vi: et sts=4 sw=4 ts=4
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Test::Simple
|
|
tests => 1;
|
|
|
|
use FindBin qw//;
|
|
use lib $FindBin::RealBin;
|
|
use TestFunctions;
|
|
|
|
my $test_dir = &mktempdir;
|
|
&put_file(
|
|
"$test_dir/1",
|
|
"$test_dir/2",
|
|
);
|
|
|
|
my (undef, $stdout, $stderr) = &run_script_capture('-f', $test_dir);
|
|
ok "freed 1,048,576 bytes (1 MB)\n" eq $stderr, 'prints freed bytes with commas';
|
|
|
|
sub put_file {
|
|
my $bytes = 1048576; # 1 MB
|
|
foreach my $file (@_) {
|
|
open my $fh, '>', $file
|
|
or die "Failed to open file $file for writing: $!";
|
|
for (my $bytes_written = 0; $bytes_written < $bytes; ++$bytes_written) {
|
|
print $fh 'A';
|
|
}
|
|
}
|
|
}
|