70 lines
2.9 KiB
Bash
Executable File
70 lines
2.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
missing_root=/tmp/does-not-exist-linuxcnc
|
|
missing_root_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_missing_root.XXXXXX.log")
|
|
grep -F 'exec 9>"${TMPDIR:-/tmp}/cnc_sim_rs274_source_link.lock"' test-linuxcnc-source-link.sh >/dev/null
|
|
grep -F "flock 9" test-linuxcnc-source-link.sh >/dev/null
|
|
grep -F 'exec 9>"${TMPDIR:-/tmp}/cnc_sim_linuxcnc_rs274_native.lock"' test-linuxcnc-rs274-native.sh >/dev/null
|
|
grep -F "flock 9" test-linuxcnc-rs274-native.sh >/dev/null
|
|
for script in \
|
|
test-linuxcnc-bridge-native.sh \
|
|
test-linuxcnc-rs274-native.sh \
|
|
test-linuxcnc-api-native.sh; do
|
|
if LINUXCNC_ROOT="$missing_root" "./$script" >"$missing_root_log" 2>&1; then
|
|
echo "$script accepted missing LinuxCNC root: $missing_root" >&2
|
|
exit 1
|
|
fi
|
|
if ! grep -F "missing LinuxCNC root: $missing_root" "$missing_root_log" >/dev/null; then
|
|
echo "$script did not report missing LinuxCNC root clearly" >&2
|
|
sed -n '1,20p' "$missing_root_log" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
rm -f "$missing_root_log"
|
|
|
|
unknown_group_manifest=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_unknown_manifest_group.XXXXXX.txt")
|
|
unknown_group_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_unknown_manifest_group.XXXXXX.log")
|
|
printf 'bogus:src/emc/rs274ngc/interp_arc.cc:test unknown group\n' >"$unknown_group_manifest"
|
|
for script in \
|
|
test-linuxcnc-source-syntax.sh \
|
|
test-linuxcnc-source-objects.sh \
|
|
test-linuxcnc-source-link.sh; do
|
|
if "./$script" "$unknown_group_manifest" >"$unknown_group_log" 2>&1; then
|
|
echo "$script accepted unknown manifest group" >&2
|
|
exit 1
|
|
fi
|
|
if ! grep -F "unknown manifest group: bogus" "$unknown_group_log" >/dev/null; then
|
|
echo "$script did not report unknown manifest group clearly" >&2
|
|
sed -n '1,20p' "$unknown_group_log" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
rm -f "$unknown_group_manifest" "$unknown_group_log"
|
|
|
|
missing_source_manifest=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_syntax_missing_source_manifest.XXXXXX.txt")
|
|
missing_source_log=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_native_syntax_missing_source.XXXXXX.log")
|
|
printf 'core:src/emc/rs274ngc/does_not_exist.cc:test missing source\n' >"$missing_source_manifest"
|
|
if ./test-linuxcnc-source-syntax.sh "$missing_source_manifest" >"$missing_source_log" 2>&1; then
|
|
echo "test-linuxcnc-source-syntax.sh accepted missing manifest file" >&2
|
|
exit 1
|
|
fi
|
|
if ! grep -F "missing manifest file: src/emc/rs274ngc/does_not_exist.cc" "$missing_source_log" >/dev/null; then
|
|
echo "test-linuxcnc-source-syntax.sh did not report missing manifest file clearly" >&2
|
|
sed -n '1,20p' "$missing_source_log" >&2
|
|
exit 1
|
|
fi
|
|
rm -f "$missing_source_manifest" "$missing_source_log"
|
|
|
|
./test-native.sh
|
|
./test-linuxcnc-source-syntax.sh
|
|
./test-linuxcnc-source-objects.sh
|
|
./test-linuxcnc-source-link.sh
|
|
./test-linuxcnc-bridge-native.sh
|
|
./test-linuxcnc-rs274-native.sh
|
|
./test-linuxcnc-api-native.sh
|
|
|
|
echo "all native tests passed"
|