|
9 | 9 | use Cwd;
|
10 | 10 | use File::Copy;
|
11 | 11 |
|
| 12 | +use Installqw(Install); |
| 13 | + |
12 | 14 | my$startdir = getcwd();
|
13 | 15 |
|
14 | 16 | chdir"../../.."if (-d"../../../src/tools/msvc");
|
15 | 17 |
|
| 18 | +my$topdir = getcwd(); |
| 19 | + |
16 | 20 | require'src/tools/msvc/config_default.pl';
|
17 | 21 | require'src/tools/msvc/config.pl'if (-f'src/tools/msvc/config.pl');
|
18 | 22 |
|
19 | 23 | # buildenv.pl is for specifying the build environment settings
|
20 |
| -# it shouldcontian lines like: |
| 24 | +# it shouldcontain lines like: |
21 | 25 | # $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";
|
22 | 26 |
|
23 | 27 | if (-e"src/tools/msvc/buildenv.pl")
|
|
27 | 31 |
|
28 | 32 | my$what =shift ||"";
|
29 | 33 | if ($what =~
|
30 |
| -/^(check|installcheck|plcheck|contribcheck|ecpgcheck|isolationcheck)$/i) |
| 34 | +/^(check|installcheck|plcheck|contribcheck|ecpgcheck|isolationcheck|upgradecheck)$/i) |
31 | 35 | {
|
32 | 36 | $what =uc$what;
|
33 | 37 | }
|
|
53 | 57 | $schedule ="parallel"if ($whateq'CHECK' ||$what =~/PARALLEL/);
|
54 | 58 | }
|
55 | 59 |
|
56 |
| -my$topdir = getcwd(); |
57 |
| - |
58 | 60 | $ENV{PERL5LIB} ="$topdir/src/tools/msvc";
|
59 | 61 |
|
60 | 62 | my$maxconn ="";
|
|
73 | 75 | INSTALLCHECK=> \&installcheck,
|
74 | 76 | ECPGCHECK=> \&ecpgcheck,
|
75 | 77 | CONTRIBCHECK=> \&contribcheck,
|
76 |
| -ISOLATIONCHECK=> \&isolationcheck,); |
| 78 | +ISOLATIONCHECK=> \&isolationcheck, |
| 79 | +UPGRADECHECK=> \&upgradecheck,); |
77 | 80 |
|
78 | 81 | my$proc =$command{$what};
|
79 | 82 |
|
@@ -231,6 +234,75 @@ sub contribcheck
|
231 | 234 | exit$mstatif$mstat;
|
232 | 235 | }
|
233 | 236 |
|
| 237 | +subupgradecheck |
| 238 | +{ |
| 239 | +my$status; |
| 240 | +my$cwd = getcwd(); |
| 241 | + |
| 242 | +# Much of this comes from the pg_upgrade test.sh script, |
| 243 | +# but it only covers the --install case, and not the case |
| 244 | +# where the old and new source or bin dirs are different. |
| 245 | +# i.e. only the this version to this version check. That's |
| 246 | +# what pg_upgrade's "make check" does. |
| 247 | + |
| 248 | +$ENV{PGPORT} ||= 50432; |
| 249 | +my$tmp_root ="$topdir/contrib/pg_upgrade/tmp_check"; |
| 250 | +(mkdir$tmp_root ||die$!)unless-d$tmp_root; |
| 251 | +my$tmp_install ="$tmp_root/install"; |
| 252 | +print"Setting up temp install\n\n"; |
| 253 | +Install($tmp_install,$config); |
| 254 | +# Install does a chdir, so change back after that |
| 255 | +chdir$cwd; |
| 256 | +my ($bindir,$libdir,$oldsrc,$newsrc) = |
| 257 | + ("$tmp_install/bin","$tmp_install/lib",$topdir,$topdir); |
| 258 | +$ENV{PATH} ="$bindir;$ENV{PATH}"; |
| 259 | +my$data ="$tmp_root/data"; |
| 260 | +$ENV{PGDATA} =$data; |
| 261 | +my$logdir ="$topdir/contrib/pg_upgrade/log"; |
| 262 | +(mkdir$logdir ||die$!)unless-d$logdir; |
| 263 | +print"\nRunning initdb on old cluster\n\n"; |
| 264 | +system("initdb") == 0orexit 1; |
| 265 | +print"\nStarting old cluster\n\n"; |
| 266 | +system("pg_ctl start -l$logdir/postmaster1.log -w") == 0orexit 1; |
| 267 | +print"\nSetting up data for upgrading\n\n"; |
| 268 | +installcheck(); |
| 269 | +# now we can chdir into the source dir |
| 270 | +chdir"$topdir/contrib/pg_upgrade"; |
| 271 | +print"\nDuming old cluster\n\n"; |
| 272 | +system("pg_dumpall -f$tmp_root/dump1.sql") == 0orexit 1; |
| 273 | +print"\nStopping old cluster\n\n"; |
| 274 | +system("pg_ctl -m fast stop") == 0orexit 1; |
| 275 | +rename$data,"$data.old"; |
| 276 | +print"\nSetting up new cluster\n\n"; |
| 277 | +system("initdb") == 0orexit 1; |
| 278 | +print"\nRunning pg_upgrade\n\n"; |
| 279 | +system("pg_upgrade -d$data.old -D$data -b$bindir -B$bindir") == 0 |
| 280 | +orexit 1; |
| 281 | +print"\nStarting new cluster\n\n"; |
| 282 | +system("pg_ctl -l$logdir/postmaster2.log -w start") == 0orexit 1; |
| 283 | +print"\nSetting up stats on new cluster\n\n"; |
| 284 | +system(".\\analyze_new_cluster.bat") == 0orexit 1; |
| 285 | +print"\nDumping new cluster\n\n"; |
| 286 | +system("pg_dumpall -f$tmp_root/dump2.sql") == 0orexit 1; |
| 287 | +print"\nStopping new cluster\n\n"; |
| 288 | +system("pg_ctl -m fast stop") == 0orexit 1; |
| 289 | +print"\nDeleting old cluster\n\n"; |
| 290 | +system(".\\delete_old_cluster.bat") == 0orexit 1; |
| 291 | +print"\nComparing old and new cluster dumps\n\n"; |
| 292 | + |
| 293 | +system("diff -q$tmp_root/dump1.sql$tmp_root/dump2.sql"); |
| 294 | +$status =$?; |
| 295 | +if (!$status) |
| 296 | +{ |
| 297 | +print"PASSED\n"; |
| 298 | +} |
| 299 | +else |
| 300 | +{ |
| 301 | +print"dumps not identical!\n"; |
| 302 | +exit(1); |
| 303 | +} |
| 304 | +} |
| 305 | + |
234 | 306 | subfetchRegressOpts
|
235 | 307 | {
|
236 | 308 | my$handle;
|
|