blob: 4fdb0dd4290b68b1047abb988ccbe5f67d1b36b7 (
plain)
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
33
34
35
36
37
38
39
|
#!/usr/bin/perl
# Simple check of a stateful encoding.
# Usage: check-stateful BUILDDIR SRCDIR CHARSET
use warnings;
use strict;
if (@ARGV < 3) {
print "Usage: check-stateful <builddir> <exeext> <srcdir> <charset>\n";
exit;
}
my $builddir = shift @ARGV;
my $exeext = shift @ARGV;
my $srcdir = shift @ARGV;
my $charset = shift @ARGV;
# charset, modified for use in filenames.
my $charsetf = $charset;
$charsetf =~ s/:/-/g;
command("$builddir/module_iconv$exeext -f $charset -t UTF-8 -o $builddir/tmp-snippet $srcdir/$charsetf-snippet");
command("cmp $srcdir/$charsetf-snippet.UTF-8 $builddir/tmp-snippet");
command("$builddir/module_iconv$exeext -f UTF-8 -t $charset -o $builddir/tmp-snippet $srcdir/$charsetf-snippet.UTF-8");
command("cmp $srcdir/$charsetf-snippet $builddir/tmp-snippet");
command("rm -f $builddir/tmp-snippet");
sub command {
my $cmd = shift;
print "> $cmd\n";
my @output = `$cmd 2>&1`;
foreach my $line (@output) {
print "| $line";
}
my $status = $? / 256;
die "$cmd:\nexit status $status\n" if $status;
return @output;
}
|