• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mbland / go-script-bash
95%
master: 95%

Build:
Build:
LAST BUILD BRANCH: multiple-script-dirs
DEFAULT BRANCH: master
Repo Added 13 Sep 2016 05:47PM CUT
Files 69
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH forwarding-script
branch: forwarding-script
CHANGE BRANCH
x
Reset
  • forwarding-script
  • appveyor
  • bats-helpers
  • bats-v1.0.1
  • cl-assertions-#181
  • cla-#214
  • cla-#217
  • close-bats-fd-3
  • copy-#184
  • create-fwd-script-#186
  • diff-lib
  • fileutil-module-#184
  • fix-coverage-kcov-v35
  • fix-fileutil-create-dirs-msys2
  • go-template-download
  • issue-template
  • master
  • mirror-dir-#186
  • native-path-#186-#187
  • null
  • path-lib
  • platform-#184
  • platform-freebsd
  • run-script-helpers
  • skip-if-none-present-#186
  • skip-template-test
  • stub-hash-reset
  • tarball-#186
  • v1.6.0
  • v1.7.0
  • walk-#184

pending completion
693

push

travis-ci

mbland
bats/helpers: Improve create_forwarding_script

Also adds `create_forwarding_scripts` to create multiple forwarding
scripts in one call.

The updates to `create_forwrading_script` addresses several shortcomings
that became apparent while using it to test the new test helper
`skip_if_missing_background_utilities` that I'm adding as part of #181.

First, I needed a way to better restrict the `PATH` of the forwarded
command. Trying to set `PATH` while invoking `create_forwarding_script`
would lead to no forwarding script being created if `PATH` excluded the
directory containing the forwarded program. The new `--path` option
resolves this.

That specific change also resolved a bug where `$@` was passed to
`stub_program_in_path`, rather than just the command name argument,
causing the script to contain the arguments after the command name.

It then became apparent that the forwarding script needed to `exec` the
wrapped command. As explained in the implementation comments:

  The `exec` feature of the forwarding script is crucial, otherwise the
  parent process ID within the executed program will be set to the
  process ID of the wrapper, not the process that invoked the wrapper.

  For example, not calling `exec` confuses `bats-exec-test`, which
  invokes itself via `bats_perform_tests`. As a result, in the parent
  process, `bats_preprocess_source` creates BATS_TEST_SOURCE based on
  BATS_TMPNAME, which is based on $$; then
  `bats_evaluate_preprocessed_source` in the child process tries to
  execute BATS_TEST_SOURCE based on BATS_PARENT_TMPNAME, which is based
  on $PPID. Since they're different, Bats raises a 'No such file or
  directory' error.

  The correct thing for Bats to do is prefix its self-execution with
  `BATS_TEST_SOURCE="$BATS_TEST_SOURCE"`, but it's still good practice
  to use `exec` here, and to understand why it's important.

2812 of 2971 relevant lines covered (94.65%)

248.57 hits per line

Relevant lines Covered
Build:
Build:
2971 RELEVANT LINES 2812 COVERED LINES
248.57 HITS PER LINE
Source Files on forwarding-script
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Loading...
Coverage∆FileLinesRelevantCoveredMissedHits/Line
No data available in table
Showing 0 to 0 of 0 entries
  • Previous
  • Next

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
693 forwarding-script bats/helpers: Improve create_forwarding_script Also adds `create_forwarding_scripts` to create multiple forwarding scripts in one call. The updates to `create_forwrading_script` addresses several shortcomings that became apparent while using it ... push 01 Sep 2017 02:10AM CUT mbland travis-ci pending completion  
See All Builds (758)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc