@ -18,6 +18,7 @@
# include "postgres_fe.h"
# include "lib/stringinfo.h"
# include "pg_regress.h"
/*
@ -34,8 +35,7 @@ psql_start_test(const char *testname,
char infile [ MAXPGPATH ] ;
char outfile [ MAXPGPATH ] ;
char expectfile [ MAXPGPATH ] ;
char psql_cmd [ MAXPGPATH * 3 ] ;
size_t offset = 0 ;
StringInfoData psql_cmd ;
char * appnameenv ;
/*
@ -62,40 +62,29 @@ psql_start_test(const char *testname,
add_stringlist_item ( resultfiles , outfile ) ;
add_stringlist_item ( expectfiles , expectfile ) ;
initStringInfo ( & psql_cmd ) ;
if ( launcher )
{
offset + = snprintf ( psql_cmd + offset , sizeof ( psql_cmd ) - offset ,
" %s " , launcher ) ;
if ( offset > = sizeof ( psql_cmd ) )
{
fprintf ( stderr , _ ( " command too long \n " ) ) ;
exit ( 2 ) ;
}
}
appendStringInfo ( & psql_cmd , " %s " , launcher ) ;
/*
* Use HIDE_TABLEAM to hide different AMs to allow to use regression tests
* against different AMs without unnecessary differences .
*/
offset + = snprintf ( psql_cmd + offset , sizeof ( psql_cmd ) - offset ,
" \" %s%spsql \" -X -a -q -d \" %s \" %s < \" %s \" > \" %s \" 2>&1 " ,
bindir ? bindir : " " ,
bindir ? " / " : " " ,
dblist - > str ,
" -v HIDE_TABLEAM=on -v HIDE_TOAST_COMPRESSION=on " ,
infile ,
outfile ) ;
if ( offset > = sizeof ( psql_cmd ) )
{
fprintf ( stderr , _ ( " command too long \n " ) ) ;
exit ( 2 ) ;
}
appendStringInfo ( & psql_cmd ,
" \" %s%spsql \" -X -a -q -d \" %s \" %s < \" %s \" > \" %s \" 2>&1 " ,
bindir ? bindir : " " ,
bindir ? " / " : " " ,
dblist - > str ,
" -v HIDE_TABLEAM=on -v HIDE_TOAST_COMPRESSION=on " ,
infile ,
outfile ) ;
appnameenv = psprintf ( " pg_regress/%s " , testname ) ;
setenv ( " PGAPPNAME " , appnameenv , 1 ) ;
free ( appnameenv ) ;
pid = spawn_process ( psql_cmd ) ;
pid = spawn_process ( psql_cmd . data ) ;
if ( pid = = INVALID_PID )
{
@ -106,6 +95,8 @@ psql_start_test(const char *testname,
unsetenv ( " PGAPPNAME " ) ;
pfree ( psql_cmd . data ) ;
return pid ;
}