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

Sandro Santilli strk at kbt.io
Wed Sep 7 11:21:35 PDT 2016


Author: strk
Date: 2016-09-07 11:21:35 -0700 (Wed, 07 Sep 2016)
New Revision: 15079

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

Modified: trunk/regress/run_test.pl
===================================================================
--- trunk/regress/run_test.pl	2016-09-07 18:15:24 UTC (rev 15078)
+++ trunk/regress/run_test.pl	2016-09-07 18:21:35 UTC (rev 15079)
@@ -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();
 	}
@@ -442,18 +442,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)
@@ -497,7 +497,7 @@
 # Utility functions
 #
 
-sub usage 
+sub usage
 {
 	die qq{
 Usage: $0 [<options>] <testname> [<testname>]
@@ -540,7 +540,7 @@
 	print ".";
 }
 
-# pass <msg> 
+# pass <msg>
 sub pass
 {
   my $msg = shift;
@@ -574,10 +574,10 @@
 	$FAIL++;
 }
 
-  
 
+
 ##################################################################
-# run_simple_sql 
+# run_simple_sql
 #   Run an sql script and hide results unless it fails.
 #   SQL input file name is $1
 ##################################################################
@@ -585,7 +585,7 @@
 {
 	my $sql = shift;
 
-	if ( ! -r $sql ) 
+	if ( ! -r $sql )
 	{
 		fail("can't read $sql");
 		return 0;
@@ -597,18 +597,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);
@@ -624,7 +624,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
@@ -650,7 +650,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
 ##################################################################
@@ -665,7 +665,7 @@
 		fail("can't read $sql");
 		return 0;
 	}
-	
+
 	if ( ! $OPT_EXPECT )
 	{
 		if ( ! -r "$expected" )
@@ -728,10 +728,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;
 	}
@@ -739,7 +739,7 @@
 
 	# Clean up interim stuff
 	#remove_tree($betmpdir);
-	
+
 	if ( $OPT_EXPECT )
 	{
 		print " (expected)";
@@ -762,7 +762,7 @@
 			return 1;
 		}
 	}
-	
+
 	return 1;
 }
 
@@ -795,7 +795,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";
 
@@ -823,7 +823,7 @@
 				return 0;
 			}
 		}
-		
+
 		# Run the loader SQL script.
 		show_progress();
 		$cmd = "psql $psql_opts -f $outfile $DB > $errfile 2>&1";
@@ -865,13 +865,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);
@@ -879,11 +879,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 )
 			{
@@ -922,7 +922,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";
 
@@ -930,20 +930,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();
@@ -953,7 +953,7 @@
 				fail(" $description: actual SQL does not match expected.", "$outfile");
 				return 0;
 			}
-	        
+
         }
 
 		# Run the loader SQL script.
@@ -973,26 +973,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);
@@ -1060,22 +1060,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";
 
@@ -1149,14 +1149,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);
@@ -1174,9 +1174,9 @@
 	{
 		return 0;
 	}
-	
+
 	drop_table($tblname);
-	
+
 	return 1;
 }
 
@@ -1187,15 +1187,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;
@@ -1211,7 +1211,7 @@
 	return system($cmd);
 }
 
-sub create_spatial 
+sub create_spatial
 {
 	my ($cmd, $rv);
 	print "Creating database '$DB' \n";
@@ -1224,7 +1224,7 @@
 	# Count database objects before installing anything
 	$OBJ_COUNT_PRE = count_db_objects();
 
-	if ( $OPT_EXTENSIONS ) 
+	if ( $OPT_EXTENSIONS )
 	{
 		prepare_spatial_extensions();
 	}
@@ -1239,12 +1239,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
@@ -1275,7 +1275,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);
@@ -1325,14 +1325,14 @@
 	load_sql_file("${STAGED_SCRIPTS_DIR}/postgis.sql", 1);
 	load_sql_file("${STAGED_SCRIPTS_DIR}/postgis_comments.sql", 0);
 	load_sql_file("${STAGED_SCRIPTS_DIR}/postgis_proc_set_search_path.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";
@@ -1368,8 +1368,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);
@@ -1383,8 +1383,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);
@@ -1423,7 +1423,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";
@@ -1433,7 +1433,7 @@
         die;
       }
     }
-    
+
     return 1;
 }
 
@@ -1462,9 +1462,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
@@ -1481,7 +1481,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"
@@ -1495,9 +1495,9 @@
 {
 	my $ok;
 	start_test("uninstall");
-	
+
 	if ( $OPT_EXTENSIONS )
-	{	
+	{
 		$ok = drop_spatial_extensions();
 	}
 	else
@@ -1505,11 +1505,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)");
@@ -1521,9 +1521,9 @@
 			return 1;
 		}
 	}
-	
+
 	return 0;
-}  
+}
 
 # Dump and restore the database
 sub dump_restore



More information about the postgis-tickets mailing list