Compare commits
No commits in common. "df3045e424e318c0881f4e6e4d82c090dd63d0ed" and "e28290ed79d0867dc13e035e82bdcc55ed9684d1" have entirely different histories.
df3045e424
...
e28290ed79
5
Makefile
5
Makefile
@ -42,11 +42,6 @@ dockertest:
|
|||||||
> $(MAKE) -C docker/organic_test
|
> $(MAKE) -C docker/organic_test
|
||||||
> docker run --rm -i -t -v "$$(readlink -f ./):/.source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry -w / organic-test sh -c "cp -r /.source /source && cd /source && cargo test --no-fail-fast --lib --test test_loader"
|
> docker run --rm -i -t -v "$$(readlink -f ./):/.source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry -w / organic-test sh -c "cp -r /.source /source && cd /source && cargo test --no-fail-fast --lib --test test_loader"
|
||||||
|
|
||||||
.PHONY: dockerclean
|
|
||||||
dockerclean:
|
|
||||||
# Delete volumes created for running the tests in docker. This does not touch anything related to the jaeger docker container.
|
|
||||||
> docker volume rm cargo-cache rust-cache
|
|
||||||
|
|
||||||
.PHONY: integrationtest
|
.PHONY: integrationtest
|
||||||
integrationtest:
|
integrationtest:
|
||||||
> cargo test --no-fail-fast --test test_loader -- --test-threads $(TESTJOBS)
|
> cargo test --no-fail-fast --test test_loader -- --test-threads $(TESTJOBS)
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
set -euo pipefail
|
|
||||||
IFS=$'\n\t'
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
: ${SHELL:="NO"} # or YES to launch a shell instead of running the test
|
|
||||||
: ${TRACE:="NO"} # or YES to send traces to jaeger
|
|
||||||
: ${BACKTRACE:="NO"} # or YES to print a rust backtrace when panicking
|
|
||||||
|
|
||||||
cd "$DIR/../"
|
|
||||||
REALPATH=$(command -v uu-realpath || command -v realpath)
|
|
||||||
MAKE=$(command -v gmake || command -v make)
|
|
||||||
|
|
||||||
function main {
|
|
||||||
local org_file="$($REALPATH "$1")"
|
|
||||||
build_container
|
|
||||||
launch_container "$org_file"
|
|
||||||
}
|
|
||||||
|
|
||||||
function build_container {
|
|
||||||
$MAKE -C "$DIR/../docker/organic_test"
|
|
||||||
}
|
|
||||||
|
|
||||||
function launch_container {
|
|
||||||
local org_file="$1"
|
|
||||||
local additional_flags=()
|
|
||||||
local additional_args=()
|
|
||||||
|
|
||||||
local init_script=$(cat <<EOF
|
|
||||||
set -euo pipefail
|
|
||||||
IFS=\$'\n\t'
|
|
||||||
|
|
||||||
cargo run -- /input.org
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ "$SHELL" != "YES" ]; then
|
|
||||||
additional_args+=(sh -c "$init_script")
|
|
||||||
else
|
|
||||||
additional_flags+=(-i -t)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$TRACE" = "YES" ]; then
|
|
||||||
# We use the host network so it can talk to jaeger hosted at 127.0.0.1
|
|
||||||
additional_flags+=(--network=host --env RUST_LOG=debug)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$BACKTRACE" = "YES" ]; then
|
|
||||||
additional_flags+=(--env RUST_BACKTRACE=full)
|
|
||||||
fi
|
|
||||||
|
|
||||||
docker run "${additional_flags[@]}" --rm -v "${org_file}:/input.org:ro" -v "$($REALPATH ./):/source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test "${additional_args[@]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
main "${@}"
|
|
@ -4,33 +4,17 @@ set -euo pipefail
|
|||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
cd "$DIR/../"
|
|
||||||
REALPATH=$(command -v uu-realpath || command -v realpath)
|
REALPATH=$(command -v uu-realpath || command -v realpath)
|
||||||
MAKE=$(command -v gmake || command -v make)
|
|
||||||
|
|
||||||
function main {
|
samples_dir=$(readlink -f "$DIR/../org_mode_samples")
|
||||||
local test_names=$(get_test_names "${@}")
|
|
||||||
build_container
|
|
||||||
|
|
||||||
local test
|
|
||||||
while read test; do
|
|
||||||
launch_container "$test"
|
|
||||||
done<<<"$test_names"
|
|
||||||
}
|
|
||||||
|
|
||||||
function build_container {
|
|
||||||
$MAKE -C "$DIR/../docker/organic_test"
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_test_names {
|
function get_test_names {
|
||||||
local test_file
|
|
||||||
local samples_dir=$($REALPATH "$DIR/../org_mode_samples")
|
|
||||||
for test_file in "$@"
|
for test_file in "$@"
|
||||||
do
|
do
|
||||||
if [ -e "$test_file" ]; then
|
if [ -e "$test_file" ]; then
|
||||||
local test_file_full_path=$($REALPATH "$test_file")
|
test_file_full_path=$(readlink -f "$test_file")
|
||||||
local relative_to_samples=$($REALPATH --relative-to "$samples_dir" "$test_file_full_path")
|
relative_to_samples=$($REALPATH --relative-to "$samples_dir" "$test_file_full_path")
|
||||||
local without_extension="${relative_to_samples%.org}"
|
without_extension="${relative_to_samples%.org}"
|
||||||
echo "${without_extension/\//_}" | tr '[:upper:]' '[:lower:]'
|
echo "${without_extension/\//_}" | tr '[:upper:]' '[:lower:]'
|
||||||
else
|
else
|
||||||
echo "$test_file" | tr '[:upper:]' '[:lower:]'
|
echo "$test_file" | tr '[:upper:]' '[:lower:]'
|
||||||
@ -38,20 +22,10 @@ function get_test_names {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function launch_container {
|
get_test_names "$@" | while read test; do
|
||||||
local test="$1"
|
(
|
||||||
local additional_args=()
|
cd "$DIR/../"
|
||||||
|
make -C docker/organic_test
|
||||||
local init_script=$(cat <<EOF
|
docker run --rm -v "$(readlink -f ./):/.source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry -w / organic-test sh -c "cp -r /.source /source && cd /source && cargo test --no-fail-fast --lib --test test_loader \"$test\" -- --show-output"
|
||||||
set -euo pipefail
|
)
|
||||||
IFS=\$'\n\t'
|
done
|
||||||
|
|
||||||
cargo test --no-fail-fast --lib --test test_loader "$test" -- --show-output
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
docker run --rm -v "$($REALPATH ./):/source:ro" --mount source=cargo-cache,target=/usr/local/cargo/registry --mount source=rust-cache,target=/target --env CARGO_TARGET_DIR=/target -w /source organic-test sh -c "$init_script"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main "${@}"
|
|
||||||
|
@ -4,27 +4,17 @@ set -euo pipefail
|
|||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
cd "$DIR/../"
|
|
||||||
REALPATH=$(command -v uu-realpath || command -v realpath)
|
REALPATH=$(command -v uu-realpath || command -v realpath)
|
||||||
|
|
||||||
function main {
|
samples_dir=$(readlink -f "$DIR/../org_mode_samples")
|
||||||
local test_names=$(get_test_names "${@}")
|
|
||||||
|
|
||||||
local test
|
|
||||||
while read test; do
|
|
||||||
cargo test --no-fail-fast --test test_loader "$test" -- --show-output
|
|
||||||
done<<<"$test_names"
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_test_names {
|
function get_test_names {
|
||||||
local test_file
|
|
||||||
local samples_dir=$($REALPATH "$DIR/../org_mode_samples")
|
|
||||||
for test_file in "$@"
|
for test_file in "$@"
|
||||||
do
|
do
|
||||||
if [ -e "$test_file" ]; then
|
if [ -e "$test_file" ]; then
|
||||||
local test_file_full_path=$($REALPATH "$test_file")
|
test_file_full_path=$(readlink -f "$test_file")
|
||||||
local relative_to_samples=$($REALPATH --relative-to "$samples_dir" "$test_file_full_path")
|
relative_to_samples=$($REALPATH --relative-to "$samples_dir" "$test_file_full_path")
|
||||||
local without_extension="${relative_to_samples%.org}"
|
without_extension="${relative_to_samples%.org}"
|
||||||
echo "${without_extension/\//_}" | tr '[:upper:]' '[:lower:]'
|
echo "${without_extension/\//_}" | tr '[:upper:]' '[:lower:]'
|
||||||
else
|
else
|
||||||
echo "$test_file" | tr '[:upper:]' '[:lower:]'
|
echo "$test_file" | tr '[:upper:]' '[:lower:]'
|
||||||
@ -32,4 +22,6 @@ function get_test_names {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
main "${@}"
|
get_test_names "$@" | while read test; do
|
||||||
|
(cd "$DIR/../" && cargo test --no-fail-fast --test test_loader "$test" -- --show-output)
|
||||||
|
done
|
||||||
|
@ -15,8 +15,7 @@ pub fn init_telemetry() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
// TODO: I think the endpoint can be controlled by the OTEL_EXPORTER_OTLP_TRACES_ENDPOINT env variable instead of hard-coded into this code base. Regardless, I am the only developer right now so I am not too concerned.
|
// TODO: I think the endpoint can be controlled by the OTEL_EXPORTER_OTLP_TRACES_ENDPOINT env variable instead of hard-coded into this code base. Regardless, I am the only developer right now so I am not too concerned.
|
||||||
let exporter = opentelemetry_otlp::new_exporter()
|
let exporter = opentelemetry_otlp::new_exporter()
|
||||||
.tonic()
|
.tonic()
|
||||||
// Using "localhost" is broken inside the docker container when tracing
|
.with_endpoint("http://localhost:4317/v1/traces");
|
||||||
.with_endpoint("http://127.0.0.1:4317/v1/traces");
|
|
||||||
|
|
||||||
let tracer = opentelemetry_otlp::new_pipeline()
|
let tracer = opentelemetry_otlp::new_pipeline()
|
||||||
.tracing()
|
.tracing()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user