Description
If a specfile include (Include) a file foo with a relative path and the directory from where shellspec is called differs from the one specified by --execdir, foo is not covered with --kcov.
In details
Consider the following lines:
(
"$SHELLSPEC_KCOV_PATH" \
$SHELLSPEC_KCOV_COMMON_OPTS \
$SHELLSPEC_KCOV_OPTS \
--bash-method=DEBUG \
--bash-parser="$SHELLSPEC_SHELL" \
--bash-parse-files-in-dir=. \
--configure=command-name="shellspec $*" \
"$SHELLSPEC_COVERAGEDIR" "$SHELLSPEC_KCOV_IN_FILE"
) 8>&1
kcov is executed inside "${PWD}" and relative paths are computed from ${PWD}; however, relative paths specified with Include are relative to "${SHELLSPEC_EXECDIR}".
In this way,
- when kcov get the filename from the different
traps loaded from here, the second field ${BASH_SOURCE[0]:-} has a relative path computed from "${SHELLSPEC_EXECDIR}",
- kcov tries to get the associated absolute path (here),
realpath() (called here) returns null and filename is the relative path as it was before,
- it fails here.
Solution?
I don't have a good overall view of the project and it's very likely that I'm talking nonsense. I apologize in advance if this is the case.
Hardcoded the right cd in the subshell for a small example was successful, therefore I think that a shellspec_execdir "${SHELLSPEC_EXECDIR}" should be called here or before this subshell.
Description
If a specfile include (
Include) a file foo with a relative path and the directory from whereshellspecis called differs from the one specified by--execdir, foo is not covered with--kcov.In details
Consider the following lines:
( "$SHELLSPEC_KCOV_PATH" \ $SHELLSPEC_KCOV_COMMON_OPTS \ $SHELLSPEC_KCOV_OPTS \ --bash-method=DEBUG \ --bash-parser="$SHELLSPEC_SHELL" \ --bash-parse-files-in-dir=. \ --configure=command-name="shellspec $*" \ "$SHELLSPEC_COVERAGEDIR" "$SHELLSPEC_KCOV_IN_FILE" ) 8>&1kcov is executed inside
"${PWD}"and relative paths are computed from${PWD}; however, relative paths specified withIncludeare relative to"${SHELLSPEC_EXECDIR}".In this way,
traps loaded from here, the second field${BASH_SOURCE[0]:-}has a relative path computed from"${SHELLSPEC_EXECDIR}",realpath()(called here) returns null andfilenameis the relative path as it was before,Solution?
I don't have a good overall view of the project and it's very likely that I'm talking nonsense. I apologize in advance if this is the case.
Hardcoded the right
cdin the subshell for a small example was successful, therefore I think that ashellspec_execdir "${SHELLSPEC_EXECDIR}"should be called here or before this subshell.