Invalidate units when loaded sources change
This commit is contained in:
@@ -48,4 +48,7 @@ if [[ ! -S "$socket_path" ]]; then
|
||||
fi
|
||||
|
||||
url="http://localhost/tests/cli_runner.uce?action=${action}&include_kill=${include_kill}&skip_local_service_pages=${skip_local_service_pages}"
|
||||
exec curl -sS --fail-with-body --unix-socket "$socket_path" "$url"
|
||||
curl -sS --fail-with-body --unix-socket "$socket_path" "$url"
|
||||
if [[ "$action" == "run" ]]; then
|
||||
scripts/test_dependency_invalidation.sh
|
||||
fi
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
test_name="dependency-cache-test-$$"
|
||||
source_dir="site/$test_name"
|
||||
cache_dir="${BIN_DIRECTORY:-/tmp/uce/work}$(pwd)/$source_dir"
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$source_dir" "$cache_dir"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
mkdir -p "$source_dir"
|
||||
|
||||
printf '%s\n' \
|
||||
'#ifndef UCE_DEPENDENCY_CACHE_CHILD' \
|
||||
'#define UCE_DEPENDENCY_CACHE_CHILD' \
|
||||
'String dependency_cache_marker() { return("dependency-marker-a"); }' \
|
||||
'#endif' >"$source_dir/child.uce"
|
||||
printf '%s\n' \
|
||||
'#load "child.uce"' \
|
||||
'CLI(Request& context) { print(dependency_cache_marker()); }' \
|
||||
'RENDER(Request& context) { print(dependency_cache_marker()); }' >"$source_dir/parent.uce"
|
||||
|
||||
first=$(scripts/uce-cli "/$test_name/parent.uce")
|
||||
if [[ "$first" != *dependency-marker-a* ]]; then
|
||||
echo "dependency invalidation setup failed: $first" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i 's/dependency-marker-a/dependency-marker-b/' "$source_dir/child.uce"
|
||||
second=$(scripts/uce-cli "/$test_name/parent.uce")
|
||||
if [[ "$second" != *dependency-marker-b* ]]; then
|
||||
echo "loaded dependency change did not recompile parent: $second" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "dependency invalidation passed"
|
||||
Reference in New Issue
Block a user