Skip to content

Commit

Permalink
Allow specifying a package to the test runner (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored Feb 8, 2022
1 parent 17c0142 commit a932718
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
7 changes: 6 additions & 1 deletion hooks/command
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ source $(dirname ${BASH_SOURCE})/common
# Use default julia test running harness
if [[ "${run_tests}" == "true" ]]; then
echo "+++ :julia: Running tests"
if [[ -z "${package}" ]]; then
PKG=""
else
PKG="\"${package}\""
fi
julia ${bugreport_args} --project=${project} -e "
using Pkg
Expand All @@ -14,7 +19,7 @@ if [[ "${run_tests}" == "true" ]]; then
# we set Pkg to use SSH for cloning non-PkgServer-served packages here as well
${USE_SSH_BLOCK}
Pkg.test(; coverage=$coverage,
Pkg.test(${PKG}; coverage=$coverage,
julia_args=\`$julia_args\`,
test_args=\`$test_args\`)
"
Expand Down
1 change: 1 addition & 0 deletions hooks/common
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ project=${BUILDKITE_PLUGIN_JULIA_TEST_PROJECT:-.}
upload_rr_trace=${BUILDKITE_PLUGIN_JULIA_TEST_UPLOAD_RR_TRACE:-never}
run_tests=${BUILDKITE_PLUGIN_JULIA_TEST_RUN_TESTS:-true}
custom_manifest=${BUILDKITE_PLUGIN_JULIA_TEST_CUSTOM_MANIFEST:-""}
package=${BUILDKITE_PLUGIN_JULIA_TEST_PACKAGE:-""}

CACHE_DIR=${BUILDKITE_PLUGIN_JULIA_CACHE_DIR:-${HOME}/.cache/julia-test-buildkite-plugin}
export _RR_TRACE_DIR=${CACHE_DIR}/rr_traces/${BUILDKITE_BUILD_ID}
Expand Down
3 changes: 3 additions & 0 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ configuration:
# Sets the project path to be tested, defaults to `"."`
project:
type: string
# Determine what package in the project to test
package:
type: string
# Whether to run within `rr` and upload a trace, takes one of the following options:
# - "never": `rr` is never used (this is the default)
# - "always": `rr` is used and a trace is unconditionally uploaded
Expand Down
11 changes: 10 additions & 1 deletion tests/tests.bats
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ chmod +x /usr/bin/julia
run $PWD/hooks/command

assert_output --partial " --project=. "
assert_output --partial "Pkg.test("
assert_output --partial "Pkg.test(PackageSpec[]"
assert_output --partial "coverage=true"
assert_output --partial "julia_args=\`\`"
assert_output --partial "test_args=\`\`"
Expand Down Expand Up @@ -94,6 +94,15 @@ chmod +x /usr/bin/julia
unset BUILDKITE_PLUGIN_JULIA_TEST_UPLOAD_RR_TRACE
}

@test "Parameter Setting: custom package" {
export BUILDKITE_PLUGIN_JULIA_TEST_PACKAGE="Example"
run $PWD/hooks/command

assert_output --partial "Pkg.test(\"Example\""
assert_success
unset BUILDKITE_PLUGIN_JULIA_TEST_PACKAGE
}

@test "Parameter Setting: custom_manifest" {
export BUILDKITE_PLUGIN_JULIA_TEST_CUSTOM_MANIFEST="MyManifest.toml"
run echo "1" > "Manifest.toml"
Expand Down

0 comments on commit a932718

Please sign in to comment.