Re: pg_regress: stat correct paths - Mailing list pgsql-patches

From Jorgen Austvik - Sun Norway
Subject Re: pg_regress: stat correct paths
Date
Msg-id 474C276B.1070306@sun.com
Whole thread Raw
In response to Re: pg_regress: stat correct paths  (Jorgen Austvik <Jorgen.Austvik@Sun.COM>)
Responses Re: pg_regress: stat correct paths
List pgsql-patches
Jorgen Austvik wrote:
>> Maybe push the stat operation inside convert_sourcefiles_in ?
>
> Yes, that was what I tried to do in the patch, but unfortunately I was
> too eager :) I'll send a new proposal tomorrow. Thanks for your help!

Hi,

this patch should only move the stat operation into
convert_sourcefiles_in().

The attached patch is tested by running pg_regress in a non-standard
path, and by running "make check" in pgsql plus in ecpg.

-J
--

Jørgen Austvik, Software Engineering - QA
Database Technology Group
Index: src/test/regress/pg_regress.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/test/regress/pg_regress.c,v
retrieving revision 1.38
diff -c -r1.38 pg_regress.c
*** src/test/regress/pg_regress.c    15 Nov 2007 21:14:46 -0000    1.38
--- src/test/regress/pg_regress.c    27 Nov 2007 14:13:47 -0000
***************
*** 399,404 ****
--- 399,406 ----
      char        abs_builddir[MAXPGPATH];
      char        testtablespace[MAXPGPATH];
      char        indir[MAXPGPATH];
+     struct stat    st;
+     int        ret;
      char      **name;
      char      **names;
      int            count = 0;
***************
*** 424,429 ****
--- 426,440 ----
          strcpy(abs_srcdir, abs_builddir);

      snprintf(indir, MAXPGPATH, "%s/%s", abs_srcdir, source);
+
+     ret = stat(indir, &st);
+     if ((ret != 0) || (!S_ISDIR(st.st_mode)))
+         /*
+          * No warning, to avoid noise in tests that does not have
+          * these directories, see ecpg, contrib and src/pl.
+          */
+         return;
+
      names = pgfnames(indir);
      if (!names)
          /* Error logged in pgfnames */
***************
*** 512,527 ****
  static void
  convert_sourcefiles(void)
  {
!     struct stat st;
!     int            ret;
!
!     ret = stat("input", &st);
!     if (ret == 0 && S_ISDIR(st.st_mode))
!         convert_sourcefiles_in("input", "sql", "sql");
!
!     ret = stat("output", &st);
!     if (ret == 0 && S_ISDIR(st.st_mode))
!         convert_sourcefiles_in("output", "expected", "out");
  }

  /*
--- 523,530 ----
  static void
  convert_sourcefiles(void)
  {
!     convert_sourcefiles_in("input", "sql", "sql");
!     convert_sourcefiles_in("output", "expected", "out");
  }

  /*

Attachment

pgsql-patches by date:

Previous
From: "Gevik Babakhani"
Date:
Subject: proposed patch for function parameters name refs
Next
From: "Greg Sabino Mullane"
Date:
Subject: Re: Proposed patch for operator lookup caching