mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 22:06:53 +08:00
If present, it can be one of
- "default", no-op fallback to stdio tags and erroring on standard error output.
- "exit_code", error if tool exit code is not 0. (The @jmchilton recommendation).
- "aggressive", error if tool exit code is not 0 or either Exception: or Error: appears in standard error/output. (The @bgruening recommendation).
Refactoring and unit/functional tests to support and demonstrate this.
Run functional test with:
./run_tests.sh -framework -id detect_errors_aggressive
Run relevant unit tests:
nosetests test/unit/tools/test_parsing.py
Updated from original version to reflect comments on pull request #117 - in particular the ``detect_errors`` tag was moved from ``tool`` to ``command``.
52 lines
1.9 KiB
XML
52 lines
1.9 KiB
XML
<tool id="detect_errors_aggressive" name="detect_errors_aggressive" version="1.0.0">
|
|
<command detect_errors="aggressive">
|
|
#if $error_bool
|
|
echo "ERROR: Problem...."
|
|
#elif $exception_bool
|
|
echo "Exception: Problem..."
|
|
#else
|
|
echo "Everything is OK."
|
|
#end if
|
|
; sh -c "exit $exit_code"
|
|
|
|
</command>
|
|
<inputs>
|
|
<param name="error_bool" type="boolean" label="error bool" />
|
|
<param name="exception_bool" type="boolean" label="exception bool" checked="false" />
|
|
<param name="exit_code" type="integer" value="0" label="exit code"/>
|
|
</inputs>
|
|
<outputs>
|
|
<data name="out_file1" />
|
|
</outputs>
|
|
<tests>
|
|
<test expect_exit_code="0" expect_failure="false">
|
|
<param name="error_bool" value="false" />
|
|
<param name="exception_bool" value="false" />
|
|
<param name="exit_code" value="0" />
|
|
<assert_stdout>
|
|
<has_line line="Everything is OK." />
|
|
</assert_stdout>
|
|
</test>
|
|
<test expect_exit_code="1" expect_failure="true">
|
|
<param name="error_bool" value="false" />
|
|
<param name="exception_bool" value="false" />
|
|
<param name="exit_code" value="1" />
|
|
<assert_stdout>
|
|
<has_line line="Everything is OK." />
|
|
</assert_stdout>
|
|
</test>
|
|
<test expect_exit_code="0" expect_failure="true">
|
|
<param name="error_bool" value="true" />
|
|
<param name="exception_bool" value="false" />
|
|
<param name="exit_code" value="0" />
|
|
</test>
|
|
<test expect_exit_code="0" expect_failure="true">
|
|
<param name="error_bool" value="false" />
|
|
<param name="exception_bool" value="true" />
|
|
<param name="exit_code" value="0" />
|
|
</test>
|
|
</tests>
|
|
<help>
|
|
</help>
|
|
</tool>
|