[postgis-tickets] r15081 - Style only: remove trailing blankspaces

Sandro Santilli strk at kbt.io
Wed Sep 7 11:30:38 PDT 2016


Author: strk
Date: 2016-09-07 11:30:38 -0700 (Wed, 07 Sep 2016)
New Revision: 15081

Modified:
   branches/2.2/regress/run_test.pl
Log:
Style only: remove trailing blankspaces

Modified: branches/2.2/regress/run_test.pl
===================================================================
--- branches/2.2/regress/run_test.pl	2016-09-07 18:21:43 UTC (rev 15080)
+++ branches/2.2/regress/run_test.pl	2016-09-07 18:30:38 UTC (rev 15081)
@@ -33,7 +33,7 @@
 ##################################################################
 # Usage ./run_test.pl <testname> [<testname>]
 #
-#  Create the spatial database 'postgis_reg' (or whatever $DB 
+#  Create the spatial database 'postgis_reg' (or whatever $DB
 #  is set to) if it doesn't already exist.
 #
 #  Run the <testname>.sql script
@@ -74,7 +74,7 @@
 GetOptions (
 	'verbose' => \$VERBOSE,
 	'clean' => \$OPT_CLEAN,
-	'nodrop' => \$OPT_NODROP, 
+	'nodrop' => \$OPT_NODROP,
 	'upgrade' => \$OPT_UPGRADE,
 	'upgrade-path=s' => \$OPT_UPGRADE_PATH,
 	'dumprestore' => \$OPT_DUMPRESTORE,
@@ -97,7 +97,7 @@
   {
     die "--upgrade-path is only supported with --extension"
   }
-  $OPT_UPGRADE = 1; # implied 
+  $OPT_UPGRADE = 1; # implied
   my @path = split ('--', $OPT_UPGRADE_PATH);
   $OPT_UPGRADE_FROM = $path[0]
     || die "Malformed upgrade path, <from>--<to> expected, $OPT_UPGRADE_PATH given";
@@ -170,7 +170,7 @@
 		print "failed\n";
 		die "Unable to find $exec executable.\n";
 	}
-	
+
 }
 
 if ( $OPT_WITH_RASTER )
@@ -393,13 +393,13 @@
 
 	start_test($TEST);
 
-	# Check for a "-pre.pl" file in case there are setup commands 
+	# Check for a "-pre.pl" file in case there are setup commands
     eval_file("${TEST}-pre.pl");
 
 	# Check for a "-pre.sql" file in case there is setup SQL needed before
 	# the test can be run.
 	if ( -r "${TEST}-pre.sql" )
-	{	
+	{
 		run_simple_sql("${TEST}-pre.sql");
 		show_progress();
 	}
@@ -441,18 +441,18 @@
 			print " ... but cleanup sql failed!";
 		}
 	}
-	
-	# Check for a "-post.pl" file in case there are teardown commands 
+
+	# Check for a "-post.pl" file in case there are teardown commands
     eval_file("${TEST}-post.pl");
-	
+
 }
 
 
-################################################################### 
+###################################################################
 # Uninstall postgis (serves as an uninstall test)
 ##################################################################
 
-# We only test uninstall if we've been asked to drop 
+# We only test uninstall if we've been asked to drop
 # and we did create
 # and nobody requested raster or topology
 # (until they have an uninstall script themself)
@@ -496,7 +496,7 @@
 # Utility functions
 #
 
-sub usage 
+sub usage
 {
 	die qq{
 Usage: $0 [<options>] <testname> [<testname>]
@@ -539,7 +539,7 @@
 	print ".";
 }
 
-# pass <msg> 
+# pass <msg>
 sub pass
 {
   my $msg = shift;
@@ -573,10 +573,10 @@
 	$FAIL++;
 }
 
-  
 
+
 ##################################################################
-# run_simple_sql 
+# run_simple_sql
 #   Run an sql script and hide results unless it fails.
 #   SQL input file name is $1
 ##################################################################
@@ -584,7 +584,7 @@
 {
 	my $sql = shift;
 
-	if ( ! -r $sql ) 
+	if ( ! -r $sql )
 	{
 		fail("can't read $sql");
 		return 0;
@@ -596,18 +596,18 @@
 	#print($cmd);
 	my $rv = system($cmd);
 	# Check if psql errored out.
-	if ( $rv != 0 ) 
+	if ( $rv != 0 )
 	{
 		fail("Unable to run sql script $sql", $tmpfile);
 		return 0;
 	}
-	
+
 	# Check for ERROR lines
 	open FILE, "$tmpfile";
 	my @lines = <FILE>;
 	close FILE;
 	my @errors = grep(/^ERROR/, @lines);
-	
+
 	if ( @errors > 0 )
 	{
 		fail("Errors while running sql script $sql", $tmpfile);
@@ -623,7 +623,7 @@
 	my $tblname = shift;
 	my $cmd = "psql -tXA -d $DB -c \"DROP TABLE IF EXISTS $tblname\" >> $REGRESS_LOG 2>&1";
 	my $rv = system($cmd);
-	die "Could not run: $cmd\n" if $rv;	
+	die "Could not run: $cmd\n" if $rv;
 }
 
 sub sql
@@ -649,7 +649,7 @@
 }
 
 ##################################################################
-# run_simple_test 
+# run_simple_test
 #   Run an sql script and compare results with the given expected output
 #   SQL input is ${TEST}.sql, expected output is {$TEST}_expected
 ##################################################################
@@ -664,7 +664,7 @@
 		fail("can't read $sql");
 		return 0;
 	}
-	
+
 	if ( ! $OPT_EXPECT )
 	{
 		if ( ! -r "$expected" )
@@ -727,10 +727,10 @@
 		$lines[$i] =~ s/^ROLLBACK/COMMIT/;
 		$lines[$i] =~ s/^psql.*(NOTICE|WARNING|ERROR):/\1:/g;
 	}
-	
+
 	# Write out output file
 	open(FILE, ">$outfile");
-	foreach my $l (@lines) 
+	foreach my $l (@lines)
 	{
 		print FILE $l;
 	}
@@ -738,7 +738,7 @@
 
 	# Clean up interim stuff
 	#remove_tree($betmpdir);
-	
+
 	if ( $OPT_EXPECT )
 	{
 		print " (expected)";
@@ -761,7 +761,7 @@
 			return 1;
 		}
 	}
-	
+
 	return 1;
 }
 
@@ -794,7 +794,7 @@
 	my ( $cmd, $rv );
 	my $outfile = "${TMPDIR}/loader.out";
 	my $errfile = "${TMPDIR}/loader.err";
-	
+
 	# ON_ERROR_STOP is used by psql to return non-0 on an error
 	my $psql_opts = " --no-psqlrc --variable ON_ERROR_STOP=true";
 
@@ -822,7 +822,7 @@
 				return 0;
 			}
 		}
-		
+
 		# Run the loader SQL script.
 		show_progress();
 		$cmd = "psql $psql_opts -f $outfile $DB > $errfile 2>&1";
@@ -864,13 +864,13 @@
 
 	my ($cmd, $rv);
 	my $errfile = "${TMPDIR}/dumper.err";
-	
-	if ( $run_always || -r $expected_shp_file ) 
+
+	if ( $run_always || -r $expected_shp_file )
 	{
 		show_progress();
 		$cmd = "${PGSQL2SHP} -f ${TMPDIR}/dumper $DB $tblname > $errfile 2>&1";
 		$rv = system($cmd);
-	
+
 		if ( $rv )
 		{
 			fail("$description: dumping loaded table", $errfile);
@@ -878,11 +878,11 @@
 		}
 
 		# Compare with expected output if there is any.
-		
+
 		if ( -r $expected_shp_file )
 		{
 			show_progress();
-			
+
 			my $diff = diff($expected_shp_file,  "$TMPDIR/dumper.shp");
 			if ( $diff )
 			{
@@ -921,7 +921,7 @@
 	my $expected_select_results_file = shift;
 	my $loader_options = shift;
 	my $run_always = shift;
-	
+
 	# ON_ERROR_STOP is used by psql to return non-0 on an error
 	my $psql_opts="--no-psqlrc --variable ON_ERROR_STOP=true";
 
@@ -929,20 +929,20 @@
 	my $outfile = "${TMPDIR}/loader.out";
 	my $errfile = "${TMPDIR}/loader.err";
 
-	if ( $run_always || -r $expected_sql_file || -r $expected_select_results_file ) 
+	if ( $run_always || -r $expected_sql_file || -r $expected_select_results_file )
 	{
 		show_progress();
 
 		# Produce the output SQL file.
 		$cmd = "$RASTER2PGSQL $loader_options ${TEST}.tif $tblname > $outfile 2> $errfile";
 		$rv = system($cmd);
-		
+
 		if ( $rv )
 		{
 		    fail("$description: running raster2pgsql", $errfile);
 		    return 0;
 	    }
-	    
+
 	    if ( -r $expected_sql_file )
 	    {
 	        show_progress();
@@ -952,7 +952,7 @@
 				fail(" $description: actual SQL does not match expected.", "$outfile");
 				return 0;
 			}
-	        
+
         }
 
 		# Run the loader SQL script.
@@ -972,26 +972,26 @@
     		return 0 if ( ! $rv );
     	}
 	}
-    	
+
     return 1;
 }
 
 
 
 ##################################################################
-#  run_loader_test 
+#  run_loader_test
 #
 #  Load a shapefile with different methods, create a 'select *' SQL
-#  test and run simple test with provided expected output. 
+#  test and run simple test with provided expected output.
 #
 #  SHP input is ${TEST}.shp, expected output is {$TEST}.expected
 ##################################################################
-sub run_loader_test 
+sub run_loader_test
 {
 	# See if there is a custom command-line options file
 	my $opts_file = "${TEST}.opts";
 	my $custom_opts="";
-	
+
 	if ( -r $opts_file )
 	{
 		open(FILE, $opts_file);
@@ -1059,22 +1059,22 @@
 		}
 		drop_table($tblname);
 	}
-	
+
 	return 1;
 }
 
 ##################################################################
-#  run_dumper_test 
+#  run_dumper_test
 #
 #  Run dumper and compare output with various expectances
-#  test and run simple test with provided expected output. 
+#  test and run simple test with provided expected output.
 #
 # input is ${TEST}.dmp, where last line is considered to be the
 # [table|query] argument for pgsql2shp and all the previous lines,
-# if any are 
+# if any are
 #
 ##################################################################
-sub run_dumper_test 
+sub run_dumper_test
 {
   my $dump_file  = "${TEST}.dmp";
 
@@ -1148,14 +1148,14 @@
 
 
 ##################################################################
-#  run_raster_loader_test 
+#  run_raster_loader_test
 ##################################################################
 sub run_raster_loader_test
 {
 	# See if there is a custom command-line options file
 	my $opts_file = "${TEST}.opts";
 	my $custom_opts="";
-	
+
 	if ( -r $opts_file )
 	{
 		open(FILE, $opts_file);
@@ -1173,9 +1173,9 @@
 	{
 		return 0;
 	}
-	
+
 	drop_table($tblname);
-	
+
 	return 1;
 }
 
@@ -1186,15 +1186,15 @@
 sub count_db_objects
 {
 	my $count = sql("WITH counts as (
-		select count(*) from pg_type union all 
-		select count(*) from pg_proc union all 
+		select count(*) from pg_type union all
+		select count(*) from pg_proc union all
 		select count(*) from pg_cast union all
 		select count(*) from pg_aggregate union all
 		select count(*) from pg_operator union all
 		select count(*) from pg_opclass union all
 		select count(*) from pg_namespace
 			where nspname NOT LIKE 'pg_%' union all
-		select count(*) from pg_opfamily ) 
+		select count(*) from pg_opfamily )
 		select sum(count) from counts");
 
  	return $count;
@@ -1210,7 +1210,7 @@
 	return system($cmd);
 }
 
-sub create_spatial 
+sub create_spatial
 {
 	my ($cmd, $rv);
 	print "Creating database '$DB' \n";
@@ -1223,7 +1223,7 @@
 	# Count database objects before installing anything
 	$OBJ_COUNT_PRE = count_db_objects();
 
-	if ( $OPT_EXTENSIONS ) 
+	if ( $OPT_EXTENSIONS )
 	{
 		prepare_spatial_extensions();
 	}
@@ -1238,12 +1238,12 @@
 {
 	my $file = shift;
 	my $strict = shift;
-	
+
 	if ( $strict && ! -e $file )
 	{
-		die "Unable to find $file\n"; 
+		die "Unable to find $file\n";
 	}
-	
+
 	if ( -e $file )
 	{
 		# ON_ERROR_STOP is used by psql to return non-0 on an error
@@ -1274,7 +1274,7 @@
 		$sql .= " VERSION '" . $OPT_UPGRADE_FROM . "'";
 	}
 
-	print "Preparing db '${DB}' using: ${sql}\n"; 
+	print "Preparing db '${DB}' using: ${sql}\n";
 
 	my $cmd = "psql $psql_opts -c \"". $sql . "\" $DB >> $REGRESS_LOG 2>&1";
 	my $rv = system($cmd);
@@ -1323,14 +1323,14 @@
 	# Load postgis.sql into the database
 	load_sql_file("${STAGED_SCRIPTS_DIR}/postgis.sql", 1);
 	load_sql_file("${STAGED_SCRIPTS_DIR}/postgis_comments.sql", 0);
-	
+
 	if ( $OPT_WITH_TOPO )
 	{
 		print "Loading Topology into '${DB}'\n";
 		load_sql_file("${STAGED_SCRIPTS_DIR}/topology.sql", 1);
 		load_sql_file("${STAGED_SCRIPTS_DIR}/topology_comments.sql", 0);
 	}
-	
+
 	if ( $OPT_WITH_RASTER )
 	{
 		print "Loading Raster into '${DB}'\n";
@@ -1365,8 +1365,8 @@
     {
         die "$script not found\n";
     }
-    
-    if ( $OPT_WITH_TOPO ) 
+
+    if ( $OPT_WITH_TOPO )
     {
         my $script = `ls ${STAGED_SCRIPTS_DIR}/topology_upgrade.sql`;
         chomp($script);
@@ -1380,8 +1380,8 @@
             die "$script not found\n";
         }
     }
-    
-    if ( $OPT_WITH_RASTER ) 
+
+    if ( $OPT_WITH_RASTER )
     {
         my $script = `ls ${STAGED_SCRIPTS_DIR}/rtpostgis_upgrade.sql`;
         chomp($script);
@@ -1420,7 +1420,7 @@
       die;
     }
 
-    if ( $OPT_WITH_TOPO ) 
+    if ( $OPT_WITH_TOPO )
     {
       my $sql = "ALTER EXTENSION postgis_topology UPDATE TO '${nextver}'";
       my $cmd = "psql $psql_opts -c \"" . $sql . "\" $DB >> $REGRESS_LOG 2>&1";
@@ -1430,7 +1430,7 @@
         die;
       }
     }
-    
+
     return 1;
 }
 
@@ -1459,9 +1459,9 @@
 {
     # ON_ERROR_STOP is used by psql to return non-0 on an error
     my $psql_opts="--no-psqlrc --variable ON_ERROR_STOP=true";
-    my $ok = 1; 
+    my $ok = 1;
     my ($cmd, $rv);
-    
+
     if ( $OPT_WITH_TOPO )
     {
         # NOTE: "manually" dropping topology schema as EXTENSION does not
@@ -1478,7 +1478,7 @@
         $rv = system($cmd);
         $ok = 0 if $rv;
     }
-    
+
     $cmd = "psql $psql_opts -c \"DROP EXTENSION postgis\" $DB >> $REGRESS_LOG 2>&1";
     $rv = system($cmd);
   	die "\nError encountered dropping EXTENSION POSTGIS, see $REGRESS_LOG for details\n\n"
@@ -1492,9 +1492,9 @@
 {
 	my $ok;
 	start_test("uninstall");
-	
+
 	if ( $OPT_EXTENSIONS )
-	{	
+	{
 		$ok = drop_spatial_extensions();
 	}
 	else
@@ -1502,11 +1502,11 @@
 		$ok = drop_spatial();
 	}
 
-	if ( $ok ) 
+	if ( $ok )
 	{
 		show_progress(); # on to objects count
 		$OBJ_COUNT_POST = count_db_objects();
-		
+
 		if ( $OBJ_COUNT_POST != $OBJ_COUNT_PRE )
 		{
 			fail("Object count pre-install ($OBJ_COUNT_PRE) != post-uninstall ($OBJ_COUNT_POST)");
@@ -1518,9 +1518,9 @@
 			return 1;
 		}
 	}
-	
+
 	return 0;
-}  
+}
 
 # Dump and restore the database
 sub dump_restore



More information about the postgis-tickets mailing list