Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita184e4d

Browse files
committed
Convert libpq regress script to Perl
This should ease its use on the Windows build environment.
1 parentadb9b7d commita184e4d

File tree

3 files changed

+63
-22
lines changed

3 files changed

+63
-22
lines changed

‎src/interfaces/libpq/test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ all: $(PROGS)
1515

1616
installcheck: all
1717
SRCDIR='$(top_srcdir)' SUBDIR='$(subdir)'\
18-
$(SHELL)$(top_srcdir)/$(subdir)/regress.sh
18+
$(PERL)$(top_srcdir)/$(subdir)/regress.pl
1919

2020
cleandistcleanmaintainer-clean:
2121
rm -f$(PROGS)

‎src/interfaces/libpq/test/regress.pl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/perl -w
2+
3+
use strict;
4+
5+
# use of SRCDIR/SUBDIR is required for supporting VPath builds
6+
my$srcdir =$ENV{'SRCDIR'}ordie'SRCDIR environment variable is not set';
7+
my$subdir =$ENV{'SUBDIR'}ordie'SUBDIR environment variable is not set';
8+
9+
my$regress_in ="$srcdir/$subdir/regress.in";
10+
my$expected_out ="$srcdir/$subdir/expected.out";
11+
12+
# the output file should land in the build_dir of VPath, or just in
13+
# the current dir, if VPath isn't used
14+
my$regress_out ="regress.out";
15+
16+
# open input file first, so possible error isn't sent to redirected STDERR
17+
open(REGRESS_IN,"<",$regress_in)
18+
ordie"can't open$regress_in for reading:$!";
19+
20+
# save STDOUT/ERR and redirect both to regress.out
21+
open(OLDOUT,">&", \*STDOUT)ordie"can't dup STDOUT:$!";
22+
open(OLDERR,">&", \*STDERR)ordie"can't dup STDERR:$!";
23+
24+
open(STDOUT,">",$regress_out)
25+
ordie"can't open$regress_out for writing:$!";
26+
open(STDERR,">&", \*STDOUT)ordie"can't dup STDOUT:$!";
27+
28+
# read lines from regress.in and run uri-regress on them
29+
while (<REGRESS_IN>)
30+
{
31+
chomp;
32+
print"trying$_\n";
33+
system("./uri-regress\"$_\"");
34+
print"\n";
35+
}
36+
37+
# restore STDOUT/ERR so we can print the outcome to the user
38+
open(STDERR,">&", \*OLDERR)ordie;# can't complain as STDERR is still duped
39+
open(STDOUT,">&", \*OLDOUT)ordie"Can't restore STDOUT:$!";
40+
41+
# just in case
42+
close REGRESS_IN;
43+
44+
my$diff_status =system(
45+
"diff -c\"$srcdir/$subdir/expected.out\" regress.out >regress.diff");
46+
if ($diff_status == 0)
47+
{
48+
print"="x70,"\n";
49+
print"All tests passed\n";
50+
exit 0;
51+
}
52+
else
53+
{
54+
print"="x70,"\n";
55+
print<<EOF;
56+
FAILED: the test result differs from the expected output
57+
58+
Review the difference in "$subdir/regress.diff"
59+
EOF
60+
print"="x70,"\n";
61+
exit 1;
62+
}

‎src/interfaces/libpq/test/regress.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp