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

Commit42fd80d

Browse files
committed
Fix pg_regress to check the directory it is actually reading files from,
not the image that (theoretically) should exist in the current directory.Jørgen Austvik
1 parent3f89964 commit42fd80d

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

‎src/test/regress/pg_regress.c

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.38 2007/11/15 21:14:46 momjian Exp $
14+
* $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.39 2007/11/27 19:13:30 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -399,6 +399,8 @@ convert_sourcefiles_in(char *source, char *dest, char *suffix)
399399
charabs_builddir[MAXPGPATH];
400400
chartesttablespace[MAXPGPATH];
401401
charindir[MAXPGPATH];
402+
structstatst;
403+
intret;
402404
char**name;
403405
char**names;
404406
intcount=0;
@@ -419,11 +421,23 @@ convert_sourcefiles_in(char *source, char *dest, char *suffix)
419421
* current directory.
420422
*/
421423
if (srcdir)
422-
strcpy(abs_srcdir,srcdir);
424+
strlcpy(abs_srcdir,srcdir,MAXPGPATH);
423425
else
424-
strcpy(abs_srcdir,abs_builddir);
426+
strlcpy(abs_srcdir,abs_builddir,MAXPGPATH);
425427

426428
snprintf(indir,MAXPGPATH,"%s/%s",abs_srcdir,source);
429+
430+
/* Check that indir actually exists and is a directory */
431+
ret=stat(indir,&st);
432+
if (ret!=0|| !S_ISDIR(st.st_mode))
433+
{
434+
/*
435+
* No warning, to avoid noise in tests that do not have
436+
* these directories; for example, ecpg, contrib and src/pl.
437+
*/
438+
return;
439+
}
440+
427441
names=pgfnames(indir);
428442
if (!names)
429443
/* Error logged in pgfnames */
@@ -512,16 +526,8 @@ convert_sourcefiles_in(char *source, char *dest, char *suffix)
512526
staticvoid
513527
convert_sourcefiles(void)
514528
{
515-
structstatst;
516-
intret;
517-
518-
ret=stat("input",&st);
519-
if (ret==0&&S_ISDIR(st.st_mode))
520-
convert_sourcefiles_in("input","sql","sql");
521-
522-
ret=stat("output",&st);
523-
if (ret==0&&S_ISDIR(st.st_mode))
524-
convert_sourcefiles_in("output","expected","out");
529+
convert_sourcefiles_in("input","sql","sql");
530+
convert_sourcefiles_in("output","expected","out");
525531
}
526532

527533
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp