Subject: Re: PKGSRC_RUN_TEST: build vs. install
To: Dieter Baron <dillo@danbala.ifoer.tuwien.ac.at>
From: Greg A. Woods <woods@weird.com>
List: tech-pkg
Date: 11/21/2002 16:16:28
[ On Thursday, November 21, 2002 at 21:43:34 (+0100), Dieter Baron wrote: ]
> Subject: Re: PKGSRC_RUN_TEST: build vs. install
>
> > It seems to me that PKGSRC_RUN_TEST should be done as the last action
> > step in the "build" target instead of the first action step in "install"
> > target.  I.e. like this:
> 
>   It is not run as the first step in the install target, it is a
> target on the same level as build and install.  (PKGSRC_RUN_TEST,
> however, makes it a pre-requisit for install, so it is the first
> action taken on ``make install' after a ``make build'' or ``make''.)

Well, OK, so it's the first (important) dependency of the install
target.....

>   This distinction is important, since ``make test'' should run the
> tests regardless of the setting of PKGSRC_RUN_TEST.  (That variable
> only controls if tests are run automatically before installing a
> package.)

Yes, I realized my change caused problems with "make test" very shortly
after actually trying "make test" by coincience!  :-)

I ended up reverting my first suggested change and for now just made
this minor change to fix the dependency chain (test depends on build, so
install doesn't need to when it depends on test, and I think it makes
more sense to run the test/build stuff before uptodate-pktools):

***************
*** 2540,2548 ****
  
  .if !target(install)
  .  if ${PKGSRC_RUN_TEST} == "YES" || ${PKGSRC_RUN_TEST} == "yes"
! install: uptodate-pkgtools build test ${INSTALL_COOKIE}
  .  else
! install: uptodate-pkgtools build ${INSTALL_COOKIE}
  .  endif
  .endif
  
--- 2693,2701 ----
  
  .if !target(install)
  .  if ${PKGSRC_RUN_TEST} == "YES" || ${PKGSRC_RUN_TEST} == "yes"
! install: test uptodate-pkgtools ${INSTALL_COOKIE}
  .  else
! install: build uptodate-pkgtools ${INSTALL_COOKIE}
  .  endif
  .endif
  

>   That said, I understand your concern that running the tests when you
> type ``make install'' is not entirely appropriate.  Would changing the
> all target to test if PKGSRC_RUN_TEST is set be an acceptable
> solution?  With that change, if you ran ``make'' followed by ``make
> install'', the tests would run at the end of the first make.

Yes, that's more along the lines of what I was thinking about after I
reverted my previous change to just the above one....

I was getting tired at the time though and didn't want to dive in and
try to make that change just then.  But now that you confirm my initial
hunch, I think this is all that's necessary:

***************
*** 1141,1147 ****
  .endif # OSVERSION_SPECIFIC
  
  .if !target(all)
! all: build
  .endif
  
  .if !defined(DEPENDS_TARGET)
--- 1269,1275 ----
  .endif # OSVERSION_SPECIFIC
  
  .if !target(all)
! all: test
  .endif
  
  .if !defined(DEPENDS_TARGET)


-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>