forked from dalibo/sqlserver2pgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreg.pl
More file actions
executable file
·53 lines (50 loc) · 1.44 KB
/
Copy pathreg.pl
File metadata and controls
executable file
·53 lines (50 loc) · 1.44 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl -w
# Basic regression testing. Better than nothing.
# Sorry, I cannot share the files, some of them are customers files...
use strict;
use Data::Dumper;
foreach my $file (<*.sql>)
{
my @options_to_try=('-i','-nr','-num', '-keep_identifier_case', '-validate_constraints=after', '-use_identity_column=0');
my @all_combinations=('');
foreach my $option (@options_to_try)
{
my @new;
foreach my $known(@all_combinations)
{
push @new,($known . ' ' . ' ');
push @new,($known . ' ' . $option);
}
@all_combinations=@new;
}
foreach my $options (@all_combinations)
{
print "Running test with options = <$options>, source file $file\n";
print "======================================\n";
system("dropdb reg");
system("createdb reg");
my $command=".././sqlserver2pgsql.pl -f $file -b /tmp/before -a /tmp/after -u /tmp/unsure -k /tmp/kettle -sd 1 -sh 1 -sp 1 -su 1 -sw 1 -pd 1 -ph 1 -pp 1 -pu 1 -pw 2 $options";
print $command,"\n";
system($command);
if ($? >>8)
{
die "Could not generate files for $file\n";
}
system("psql reg < /tmp/before > /tmp/before.log 2>&1");
if ($? >>8)
{
die "Before script failed for $file, with options $options\n";
}
system("psql reg < /tmp/after > /tmp/after.log 2>&1");
if ($? >>8)
{
open LOG,'/tmp/after.log';
while (<LOG>)
{
print;
}
die "After script failed for $file, with options $options\n";
}
print "OK!\n";
}
}