Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return failure code on failure; DM-1027 #1

Merged
merged 5 commits into from Aug 21, 2014
Merged

Return failure code on failure; DM-1027 #1

merged 5 commits into from Aug 21, 2014

Conversation

mjuric
Copy link
Member

@mjuric mjuric commented Aug 16, 2014

No description provided.

BUILD_TARGETS.extend(checkTestStatus_command)
state.env.AlwaysBuild(checkTestStatus_command)
#
# We don't want to clutter up the output with our check for failed tests
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels a bit hacky. Is this a standard scons idiom?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit doesn't bother me (setting PRINT_CMD_LINE_FUNC does --- if it were a unix command I could just prefix it with @ like in make).

I create an Action (checkTestStatus_command) and ask that it always run, but only when everything else has finished. I could register an atexit handler to do this (at the python level) but by then it's too late to just call sys.exit(1) --- the multiprocess cleanup complains.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you have the Command action be an actual shell script to look for and count the ".failed" files, thus enabling it to be "@"-prefixed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that an external script was an even worse solution. I should ask the scons list if there's a better solution (a keyword arg?)

    R

On 19 Aug 2014, at 04:30, ktlim notifications@github.com wrote:

In python/lsst/sconsUtils/scripts.py:

  •    #
    
  •    if "tests" in [str(t) for t in BUILD_TARGETS]:
    
  •        def __checkTestStatus( target, source, env ):
    
  •            """See if any tests failed"""
    
  •            import glob
    
  •            nFailed = len(glob.glob(os.path.join(os.getcwd(), "tests", ".tests", "*.failed")))
    
  •            if nFailed > 0:
    
  •                raise SCons.Errors.BuildError(errstr="%d tests failed" % nFailed)
    
  •        checkTestStatus_command = state.env.Command('checkTestStatus', [], __checkTestStatus)
    
  •        state.env.Depends(checkTestStatus_command, BUILD_TARGETS) # this is why the check runs last
    
  •        BUILD_TARGETS.extend(checkTestStatus_command)
    
  •        state.env.AlwaysBuild(checkTestStatus_command)
    
  •        #
    
  •        # We don't want to clutter up the output with our check for failed tests
    
    Can't you have the Command action be an actual shell script to look for and count the ".failed" files, thus enabling it to be "@"-prefixed?


Reply to this email directly or view it on GitHub.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, replaced python test with inline shell as per KT's request and stopped messing with PRINT_CMD_LINE_FUNC

Good to merge?

@mjuric
Copy link
Member Author

mjuric commented Aug 19, 2014

Should there be a unit test for this? There probably should as if this code ever gets broken (e.g., does't report failing tests) we should know right away.

@RobertLuptonTheGood
Copy link
Member

It was a bit tricky to test this. It involved a complete fake package (with a top-level SConstruct and ./{tests,ups}) living in ./tests.

Pushed.

@mjuric
Copy link
Member Author

mjuric commented Aug 20, 2014

+1. Looks good to me. Ship it!

@ktlim
Copy link
Contributor

ktlim commented Aug 20, 2014

I don't think you need an external script (as in another file). The Command() in tests.py runs a script that is entirely inline. I'd just like the PRINT_CMD_LINE_FUNC to go away if at all possible. But I'm OK with merging this and fixing that later.

@ktlim
Copy link
Contributor

ktlim commented Aug 21, 2014

Oh, in case it wasn't obvious, good to go now.

@mjuric mjuric merged commit ceefb6f into master Aug 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants