Creates normalize_modified.sed

pull/3546/head
Halil Ozan Akgul 2020-02-26 18:30:23 +03:00
parent c8a81ef1ce
commit 119bf590c8
2 changed files with 31 additions and 2 deletions

View File

@ -30,8 +30,15 @@ fi
if test -z "${VANILLATEST:-}"
then
touch "$file1" # when adding a new test the expected file does not exist
sed -Ef "$BASEDIR/normalize.sed" < "$file1" > "$file1.modified"
sed -Ef "$BASEDIR/normalize.sed" < "$file2" > "$file2.modified"
normalize_file="$BASEDIR/normalize.sed"
# when running tests on an existing cluster some changes need to be done on
# normalize.sed file. So a new file is used.
if [[ -f "$BASEDIR/normalize_modified.sed" ]]
then
normalize_file="$BASEDIR/normalize_modified.sed"
fi
sed -Ef "$normalize_file" < "$file1" > "$file1.modified"
sed -Ef "$normalize_file" < "$file2" > "$file2.modified"
"$DIFF" -w $args "$file1.modified" "$file2.modified" | LC_CTYPE=C.UTF-8 diff-filter "$BASEDIR/normalize.sed"
exit ${PIPESTATUS[0]}
else

View File

@ -300,6 +300,28 @@ if ( $conninfo )
$dbname = $convals{dbname};
}
open my $in, '<', "bin/normalize.sed" or die "Cannot open normalize.sed file\n";
open my $out, '>', "bin/normalize_modified.sed" or die "Cannot open normalize_modified.sed file\n";
while ( <$in> )
{
print $out $_;
}
close $in;
print $out "\n";
print $out "s/\\bdbname=regression\\b/dbname=<db>/g\n";
print $out "s/\\bdbname=$dbname\\b/dbname=<db>/g\n";
print $out "s/\\b$user\\b/<user>/g\n";
print $out "s/\\bpostgres\\b/<user>/g\n";
print $out "s/\\blocalhost\\b/<host>/g\n";
print $out "s/\\b$host\\b/<host>/g\n";
print $out "s/\\b576[0-9][0-9]\\b/xxxxx/g\n";
print $out "s/", substr("$masterPort", 0, length("$masterPort")-2), "[0-9][0-9]/xxxxx/g\n";
my $worker1port = `psql "$conninfo" -t -c "SELECT nodeport FROM pg_dist_node ORDER BY nodeid LIMIT 1;"`;
my $worker2port = `psql "$conninfo" -t -c "SELECT nodeport FROM pg_dist_node ORDER BY nodeid OFFSET 1 LIMIT 1;"`;