File: gen_multi_tests.pl

package info (click to toggle)
libpkgconfig-perl 0.26026-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,912 kB
  • sloc: ansic: 6,120; perl: 1,922; makefile: 4; sh: 3
file content (32 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use strict;
use warnings;
use File::Find;

my @list = ([]);

my $count = 1;
find(sub {
  /\.pc$/ && do {
    push @{ $list[-1] }, $File::Find::name;
    push @list, [] if @{ $list[-1] } == 50;
  }
}, 't/data/usr');

my $template = do {
  open my $fh, '<', 't/data/iterfiles_template';
  local $/;
  <$fh>;
};

my $i = 0;
foreach my $list (@list)
{
  my $fn = sprintf "t/02-iterfiles-FLISTa%s.t", chr(ord('a')+$i++);
  print "$fn\n";
  
  my $content = "$template";
  $content =~ s{#LIST}{join("\n", @$list)}e;
  open my $fh, '>', $fn;
  print $fh $content;
  close $fh;
}