patch: clean up ant test infrastructure

Поиск
Список
Период
Сортировка
Искать

patch: clean up ant test infrastructure

От:
Oliver Jowett <oliver@opencloud.com>
Дата:
Вложения:
This patch rearranges how tests are built and run from build.xml:

 + Make all testsuites (jdbc2, jdbc2.optional, jdbc3) independent
   i.e. they run only their own tests and not those of earlier
   versions.

 + Run all applicable testsuites for the configured JDBC version,
   e.g. run jdbc2, jdbc2.optional, and jdbc3 if we are configured
   for JDBC3. The rationale is that the JDBC2 tests should work
   on JDBC2 *or any later version*.
  
 + Use Ant's  task instead of running a JUnit UI. This cleans
   up the buildfile and produces somewhat nicer output than the text-ui.
   As Ant doesn't try to find the task class until the containing target
   is run, and we conditionalize running the test task on the
   presence of both JUnit and the JUnit task, this shouldn't cause
   errors if the task isn't present.

 + Merge the various per-version test targets into a single target with
   conditional  elements.

 + Use a separate builddir for the tests to help isolate them from the
   driver. Build a new postgresql-tests.jar jarfile containing just the tests.

 + Run the tests using the actual driver jarfile (and test jarfile)
   rather than whatever's in builddir. This should help make sure that you
   are testing the actual driver that will be used. One sideeffect of this
   is that PSQLException can find its resource bundle when running tests now
   (previously it couldn't as srcdir was not in the test classpath).

I've tested this against Ant 1.5.3 and a 1.4 JDK, with and without JUnit and
ant-optional (for the JUnit task) present. I don't have the resources to
test other JDKs or Ant versions at the moment.

-O

Re: patch: clean up ant test infrastructure

От:
Fernando Nasser <fnasser@redhat.com>
Дата:
Oliver Jowett wrote:
>   
>  + Use Ant's  task instead of running a JUnit UI. This cleans
>    up the buildfile and produces somewhat nicer output than the text-ui.
>    As Ant doesn't try to find the task class until the containing target
>    is run, and we conditionalize running the test task on the
>    presence of both JUnit and the JUnit task, this shouldn't cause
>    errors if the task isn't present.
> 

Oliver,

The Ant script really needed some TCL.  Thanks.

But with the above chunk you are taking away the opportunity of someone using 
junit.swinggui.TestRunner aren't you?  Some people like the GUI interface.
Or can it be done with the  task and I just don't know how (I believe you 
can only get text or XML with that)?

Maybe you can add a separate target so people still can get the gui version...

Regards,
Fernando



-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

Re: patch: clean up ant test infrastructure

От:
Oliver Jowett <oliver@opencloud.com>
Дата:
On Mon, Jul 21, 2003 at 11:44:41AM -0400, Fernando Nasser wrote:
> Oliver Jowett wrote:
> >  
> > + Use Ant's  task instead of running a JUnit UI. This cleans
> >   up the buildfile and produces somewhat nicer output than the text-ui.
> >   As Ant doesn't try to find the task class until the containing target
> >   is run, and we conditionalize running the test task on the
> >   presence of both JUnit and the JUnit task, this shouldn't cause
> >   errors if the task isn't present.
> >
> 
> Oliver,
> 
> The Ant script really needed some TCL.  Thanks.
> 
> But with the above chunk you are taking away the opportunity of someone 
> using junit.swinggui.TestRunner aren't you?  Some people like the GUI 
> interface.
> Or can it be done with the  task and I just don't know how (I 
> believe you can only get text or XML with that)?

I don't think you can get at an interactive interface from the  task.

My changes also add a 'testjar' target that builds a standalone test jar ..
you can always feed that to whichever junit gui you prefer. Personally, I
prefer to have it all automated and noninteractive from the build file..

> Maybe you can add a separate target so people still can get the gui 
> version...

Yes, or a separate script.

The 'test' target is invoked from 'make check', so presumably it should be
noninteractive by default.

-O (who should have been asleep 3 hours ago..)

Re: patch: clean up ant test infrastructure

От:
Barry Lind <blind@xythos.com>
Дата:
Patch applied, with a few minor changes to work correctly under jdk1.2 
and 1.3.

thanks,
--Barry


Oliver Jowett wrote:
> This patch rearranges how tests are built and run from build.xml:
> 
>  + Make all testsuites (jdbc2, jdbc2.optional, jdbc3) independent
>    i.e. they run only their own tests and not those of earlier
>    versions.
> 
>  + Run all applicable testsuites for the configured JDBC version,
>    e.g. run jdbc2, jdbc2.optional, and jdbc3 if we are configured
>    for JDBC3. The rationale is that the JDBC2 tests should work
>    on JDBC2 *or any later version*.
>   
>  + Use Ant's  task instead of running a JUnit UI. This cleans
>    up the buildfile and produces somewhat nicer output than the text-ui.
>    As Ant doesn't try to find the task class until the containing target
>    is run, and we conditionalize running the test task on the
>    presence of both JUnit and the JUnit task, this shouldn't cause
>    errors if the task isn't present.
> 
>  + Merge the various per-version test targets into a single target with
>    conditional  elements.
> 
>  + Use a separate builddir for the tests to help isolate them from the
>    driver. Build a new postgresql-tests.jar jarfile containing just the tests.
> 
>  + Run the tests using the actual driver jarfile (and test jarfile)
>    rather than whatever's in builddir. This should help make sure that you
>    are testing the actual driver that will be used. One sideeffect of this
>    is that PSQLException can find its resource bundle when running tests now
>    (previously it couldn't as srcdir was not in the test classpath).
> 
> I've tested this against Ant 1.5.3 and a 1.4 JDK, with and without JUnit and
> ant-optional (for the JUnit task) present. I don't have the resources to
> test other JDKs or Ant versions at the moment.
> 
> -O
> 
> 
> ------------------------------------------------------------------------
> 
> Index: src/interfaces/jdbc/build.xml
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/build.xml,v
> retrieving revision 1.32
> diff -u -c -r1.32 build.xml
> *** src/interfaces/jdbc/build.xml	27 Feb 2003 05:45:43 -0000	1.32
> --- src/interfaces/jdbc/build.xml	20 Jul 2003 07:56:59 -0000
> ***************
> *** 49,64 ****
>       
>       
>       
> !     
>       
>         
> !         
>           
>         
>       
>       
>         
> !         
>           
>           
>         
> --- 49,71 ----
>       
>       
>       
> !     
> !     
>       
>         
> !         
> !           
> !           
> !         
>           
>         
>       
>       
>         
> !         
> !           
> !           
> !         
>           
>           
>         
> ***************
> *** 83,89 ****
>       
>         
>           
> -         
>         
>   
>         
> --- 90,95 ----
> ***************
> *** 108,113 ****
> --- 114,121 ----
>       
>         
>   
> +       
> + 
>         
>         
>         
> ***************
> *** 274,335 ****
>     
>     
>     
> -   
> -   
> - 
>   
> !   
> !    
>   
> -   
> -     
> -       
> -     
> -    
> -       
> -       
> -       
> -       
>         
> !         
> !         
>         
> -     
> -   
> - 
> -   
> -     
> -       
> -       
>       
> !     
> !       
> !       
> !       
> !       
> !       
> !         
> !         
> !       
> !     
>     
>   
> -   
> -     
> -       
> -       
> -     
> -     
> -       
>         
>         
>         
>         
> !         
>           
>         
> -     
> -   
>   
>   
>   
> --- 282,331 ----
>     
>     
>     
>   
> !   
> ! 
> !     
> !   
> !     
> !     
> !       
> ! 
> !       
> !       
> !       
>   
>         
> !         
>         
>       
> !     
>     
> +     
> +   
> +   
> +     
> +       
>   
>         
>         
>         
> + 
>         
> !         
> !         
>           
>         
>   
> +       
> +       
> +       
> +     
> +   
> +   
> +   
> +   
>   
>   
> Index: src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java,v
> retrieving revision 1.3
> diff -u -c -r1.3 Jdbc3TestSuite.java
> *** src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java	25 Sep 2002 07:01:31 -0000	1.3
> --- src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java	20 Jul 2003 07:56:59 -0000
> ***************
> *** 14,20 ****
>   	public static TestSuite suite()
>   	{
>           TestSuite suite = new TestSuite();
> - 		suite.addTest(org.postgresql.test.jdbc2.Jdbc2TestSuite.suite());
>           suite.addTestSuite(Jdbc3SimpleDataSourceTest.class);
>           suite.addTestSuite(Jdbc3ConnectionPoolTest.class);
>           suite.addTestSuite(Jdbc3PoolingDataSourceTest.class);
> --- 14,19 ----
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


FAQ