Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdc9c3b0

Browse files
committed
Remove dynamic translation of regression test scripts, step 2.
"git mv" all the input/*.source and output/*.source files intothe corresponding sql/ and expected/ directories. Then removethe pg_regress and Makefile infrastructure associated withdynamic translation.Discussion:https://postgr.es/m/1655733.1639871614@sss.pgh.pa.us
1 parentd1029bb commitdc9c3b0

38 files changed

+8
-197
lines changed

‎contrib/dblink/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ PGFILEDESC = "dblink - connect to other PostgreSQL databases"
1313

1414
REGRESS = paths dblink
1515
REGRESS_OPTS = --dlpath=$(top_builddir)/src/test/regress
16-
EXTRA_CLEAN = sql/paths.sql expected/paths.out
1716

1817
ifdefUSE_PGXS
1918
PG_CONFIG = pg_config

‎contrib/dblink/expected/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

‎contrib/dblink/sql/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

‎contrib/file_fdw/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ PGFILEDESC = "file_fdw - foreign data wrapper for files"
88

99
REGRESS = file_fdw
1010

11-
EXTRA_CLEAN = sql/file_fdw.sql expected/file_fdw.out
12-
1311
ifdefUSE_PGXS
1412
PG_CONFIG = pg_config
1513
PGXS :=$(shell$(PG_CONFIG) --pgxs)

‎contrib/file_fdw/expected/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎contrib/file_fdw/sql/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/interfaces/ecpg/test/pg_regress_ecpg.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,14 @@ ecpg_start_test(const char *testname,
166166
snprintf(inprg,sizeof(inprg),"%s/%s",inputdir,testname);
167167
snprintf(insource,sizeof(insource),"%s.c",testname);
168168

169+
/* make a version of the test name that has dashes in place of slashes */
169170
initStringInfo(&testname_dash);
170171
appendStringInfoString(&testname_dash,testname);
171-
replace_string(&testname_dash,"/","-");
172+
for (char*c=testname_dash.data;*c!='\0';c++)
173+
{
174+
if (*c=='/')
175+
*c='-';
176+
}
172177

173178
snprintf(expectfile_stdout,sizeof(expectfile_stdout),
174179
"%s/expected/%s.stdout",

‎src/pl/plpgsql/src/Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ TOOLSDIR = $(top_srcdir)/src/tools
4141
GEN_KEYWORDLIST =$(PERL) -I$(TOOLSDIR)$(TOOLSDIR)/gen_keywordlist.pl
4242
GEN_KEYWORDLIST_DEPS =$(TOOLSDIR)/gen_keywordlist.pl$(TOOLSDIR)/PerfectHash.pm
4343

44-
# Test input and expected files. These are created by pg_regress itself, so we
45-
# don't have a rule to create them. We do need rules to clean them however.
46-
input_files =$(patsubst$(srcdir)/input/%.source,sql/%.sql,$(wildcard$(srcdir)/input/*.source))
47-
output_files :=$(patsubst$(srcdir)/output/%.source,expected/%.out,$(wildcard$(srcdir)/output/*.source))
48-
4944
all: all-lib
5045

5146
# Shared library stuff
@@ -116,7 +111,6 @@ distprep: pl_gram.h pl_gram.c plerrcodes.h pl_reserved_kwlist_d.h pl_unreserved_
116111
# are not cleaned here.
117112
cleandistclean: clean-lib
118113
rm -f$(OBJS)
119-
rm -f$(output_files)$(input_files)
120114
rm -rf$(pg_regress_clean_files)
121115

122116
maintainer-clean: distclean

‎src/pl/plpgsql/src/expected/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/pl/plpgsql/src/sql/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/test/regress/GNUmakefile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,12 @@ all: all-lib
6969
# Ensure parallel safety if a build is started in this directory
7070
$(OBJS): | submake-libpgport submake-generated-headers
7171

72-
# Test input and expected files. These are created by pg_regress itself, so we
73-
# don't have a rule to create them. We do need rules to clean them however.
74-
input_files =$(patsubst$(srcdir)/input/%.source,sql/%.sql,$(wildcard$(srcdir)/input/*.source))
75-
output_files :=$(patsubst$(srcdir)/output/%.source,expected/%.out,$(wildcard$(srcdir)/output/*.source))
76-
7772

7873
# not installed by default
7974

8075
regress_data_files =\
81-
$(filter-out$(addprefix$(srcdir)/,$(output_files)),$(wildcard$(srcdir)/expected/*.out))\
82-
$(wildcard$(srcdir)/input/*.source)\
83-
$(wildcard$(srcdir)/output/*.source)\
84-
$(filter-out$(addprefix$(srcdir)/,$(input_files)),$(wildcard$(srcdir)/sql/*.sql))\
76+
$(wildcard$(srcdir)/sql/*.sql)\
77+
$(wildcard$(srcdir)/expected/*.out)\
8578
$(wildcard$(srcdir)/data/*.data)\
8679
$(srcdir)/parallel_schedule$(srcdir)/resultmap
8780

@@ -162,6 +155,5 @@ clean distclean maintainer-clean: clean-lib
162155
rm -f $(OBJS) refint$(DLSUFFIX) autoinc$(DLSUFFIX)
163156
rm -f pg_regress_main.o pg_regress.o pg_regress$(X)
164157
# things created by various check targets
165-
rm -f $(output_files) $(input_files)
166158
rm -rf testtablespace
167159
rm -rf $(pg_regress_clean_files)

‎src/test/regress/expected/.gitignore

Lines changed: 0 additions & 10 deletions
This file was deleted.

‎src/test/regress/pg_regress.c

Lines changed: 0 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -438,155 +438,6 @@ string_matches_pattern(const char *str, const char *pattern)
438438
return false;
439439
}
440440

441-
/*
442-
* Replace all occurrences of "replace" in "string" with "replacement".
443-
* The StringInfo will be suitably enlarged if necessary.
444-
*
445-
* Note: this is optimized on the assumption that most calls will find
446-
* no more than one occurrence of "replace", and quite likely none.
447-
*/
448-
void
449-
replace_string(StringInfostring,constchar*replace,constchar*replacement)
450-
{
451-
intpos=0;
452-
char*ptr;
453-
454-
while ((ptr=strstr(string->data+pos,replace))!=NULL)
455-
{
456-
/* Must copy the remainder of the string out of the StringInfo */
457-
char*suffix=pg_strdup(ptr+strlen(replace));
458-
459-
/* Truncate StringInfo at start of found string ... */
460-
string->len=ptr-string->data;
461-
/* ... and append the replacement (this restores the trailing '\0') */
462-
appendStringInfoString(string,replacement);
463-
/* Next search should start after the replacement */
464-
pos=string->len;
465-
/* Put back the remainder of the string */
466-
appendStringInfoString(string,suffix);
467-
free(suffix);
468-
}
469-
}
470-
471-
/*
472-
* Convert *.source found in the "source" directory, replacing certain tokens
473-
* in the file contents with their intended values, and put the resulting files
474-
* in the "dest" directory, replacing the ".source" prefix in their names with
475-
* the given suffix.
476-
*/
477-
staticvoid
478-
convert_sourcefiles_in(constchar*source_subdir,constchar*dest_dir,constchar*dest_subdir,constchar*suffix)
479-
{
480-
chartesttablespace[MAXPGPATH];
481-
charindir[MAXPGPATH];
482-
charoutdir_sub[MAXPGPATH];
483-
char**name;
484-
char**names;
485-
intcount=0;
486-
487-
snprintf(indir,MAXPGPATH,"%s/%s",inputdir,source_subdir);
488-
489-
/* Check that indir actually exists and is a directory */
490-
if (!directory_exists(indir))
491-
{
492-
/*
493-
* No warning, to avoid noise in tests that do not have these
494-
* directories; for example, ecpg, contrib and src/pl.
495-
*/
496-
return;
497-
}
498-
499-
names=pgfnames(indir);
500-
if (!names)
501-
/* Error logged in pgfnames */
502-
exit(2);
503-
504-
/* Create the "dest" subdirectory if not present */
505-
snprintf(outdir_sub,MAXPGPATH,"%s/%s",dest_dir,dest_subdir);
506-
if (!directory_exists(outdir_sub))
507-
make_directory(outdir_sub);
508-
509-
/* We might need to replace @testtablespace@ */
510-
snprintf(testtablespace,MAXPGPATH,"%s/testtablespace",outputdir);
511-
512-
/* finally loop on each file and do the replacement */
513-
for (name=names;*name;name++)
514-
{
515-
charsrcfile[MAXPGPATH];
516-
chardestfile[MAXPGPATH];
517-
charprefix[MAXPGPATH];
518-
FILE*infile,
519-
*outfile;
520-
StringInfoDataline;
521-
522-
/* reject filenames not finishing in ".source" */
523-
if (strlen(*name)<8)
524-
continue;
525-
if (strcmp(*name+strlen(*name)-7,".source")!=0)
526-
continue;
527-
528-
count++;
529-
530-
/* build the full actual paths to open */
531-
snprintf(prefix,strlen(*name)-6,"%s",*name);
532-
snprintf(srcfile,MAXPGPATH,"%s/%s",indir,*name);
533-
snprintf(destfile,MAXPGPATH,"%s/%s/%s.%s",dest_dir,dest_subdir,
534-
prefix,suffix);
535-
536-
infile=fopen(srcfile,"r");
537-
if (!infile)
538-
{
539-
fprintf(stderr,_("%s: could not open file \"%s\" for reading: %s\n"),
540-
progname,srcfile,strerror(errno));
541-
exit(2);
542-
}
543-
outfile=fopen(destfile,"w");
544-
if (!outfile)
545-
{
546-
fprintf(stderr,_("%s: could not open file \"%s\" for writing: %s\n"),
547-
progname,destfile,strerror(errno));
548-
exit(2);
549-
}
550-
551-
initStringInfo(&line);
552-
553-
while (pg_get_line_buf(infile,&line))
554-
{
555-
replace_string(&line,"@abs_srcdir@",inputdir);
556-
replace_string(&line,"@abs_builddir@",outputdir);
557-
replace_string(&line,"@testtablespace@",testtablespace);
558-
replace_string(&line,"@libdir@",dlpath);
559-
replace_string(&line,"@DLSUFFIX@",DLSUFFIX);
560-
fputs(line.data,outfile);
561-
}
562-
563-
pfree(line.data);
564-
fclose(infile);
565-
fclose(outfile);
566-
}
567-
568-
/*
569-
* If we didn't process any files, complain because it probably means
570-
* somebody neglected to pass the needed --inputdir argument.
571-
*/
572-
if (count <=0)
573-
{
574-
fprintf(stderr,_("%s: no *.source files found in \"%s\"\n"),
575-
progname,indir);
576-
exit(2);
577-
}
578-
579-
pgfnames_cleanup(names);
580-
}
581-
582-
/* Create the .sql and .out files from the .source files, if any */
583-
staticvoid
584-
convert_sourcefiles(void)
585-
{
586-
convert_sourcefiles_in("input",outputdir,"sql","sql");
587-
convert_sourcefiles_in("output",outputdir,"expected","out");
588-
}
589-
590441
/*
591442
* Clean out the test tablespace dir, or create it if it doesn't exist.
592443
*
@@ -936,7 +787,6 @@ initialize_environment(void)
936787
printf(_("(using postmaster on Unix socket, default port)\n"));
937788
}
938789

939-
convert_sourcefiles();
940790
load_resultmap();
941791
}
942792

‎src/test/regress/pg_regress.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,4 @@ intregression_main(int argc, char *argv[],
6565

6666
voidadd_stringlist_item(_stringlist**listhead,constchar*str);
6767
PID_TYPEspawn_process(constchar*cmdline);
68-
voidreplace_string(structStringInfoData*string,
69-
constchar*replace,constchar*replacement);
7068
boolfile_exists(constchar*file);

‎src/test/regress/sql/.gitignore

Lines changed: 0 additions & 9 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp