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

xx-verify: skip non-binary #191

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions src/test-verify.bats
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,53 @@ load 'assert'
export TARGETPLATFORM=linux/amd64
run xx-verify /idontexist
assert_failure
}

@test "not-binary" {
export XX_VERIFY_FILE_CMD_OUTPUT="POSIX shell script, ASCII text executable"
export TARGETPLATFORM=linux/amd64
run xx-verify /idontexist
assert_success

export XX_VERIFY_FILE_CMD_OUTPUT="Bourne-Again shell script, ASCII text executable"
export TARGETPLATFORM=linux/amd64
run xx-verify /idontexist
assert_success

export XX_VERIFY_FILE_CMD_OUTPUT="Python script, ASCII text executable"
export TARGETPLATFORM=linux/amd64
run xx-verify /idontexist
assert_success

export XX_VERIFY_FILE_CMD_OUTPUT="C source, ASCII text"
export TARGETPLATFORM=linux/amd64
run xx-verify /idontexist
assert_success

export XX_VERIFY_FILE_CMD_OUTPUT="UTF-8 Unicode text"
export TARGETPLATFORM=linux/amd64
run xx-verify /idontexist
assert_success

export XX_VERIFY_FILE_CMD_OUTPUT="XML document text"
export TARGETPLATFORM=linux/amd64
run xx-verify /idontexist
assert_success

export XX_VERIFY_FILE_CMD_OUTPUT="Markdown document text"
export TARGETPLATFORM=linux/amd64
run xx-verify /idontexist
assert_success

export XX_VERIFY_FILE_CMD_OUTPUT="YAML document text"
export TARGETPLATFORM=linux/amd64
run xx-verify /idontexist
assert_success

export XX_VERIFY_FILE_CMD_OUTPUT="JSON data"
export TARGETPLATFORM=linux/amd64
run xx-verify /idontexist
assert_success

unset XX_VERIFY_FILE_CMD_OUTPUT
unset TARGETPLATFORM
Expand Down
7 changes: 7 additions & 0 deletions src/xx-verify
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ for f in "$@"; do
;;
esac

case "$out" in
*"ASCII text"* | *"Unicode text"* | *"document text"* | *"JSON data"*)
echo "skipping verification of non-binary file ${f}: $out"
exit 0
;;
esac

if [ -z "$expOS" ]; then
echo >&2 "unsupported target os ${TARGETOS}"
exit 1
Expand Down
Loading