| |
| new file mode 100644 |
| |
| |
| @@ -0,0 +1,11 @@ |
| +from manimlib.scene.scene import Scene |
| + |
| + |
| +class EmptyScene(Scene): |
| + def construct(self): |
| + self.wait(0.1) |
| + |
| + |
| +class OtherScene(Scene): |
| + def construct(self): |
| + self.wait(0.1) |
| |
| new file mode 100755 |
| |
| |
| @@ -0,0 +1,170 @@ |
| +#!/usr/bin/env bash |
| + |
| +set -u |
| +export LANG=C.UTF-8 LC_ALL=C.UTF-8 TZ=UTC |
| + |
| + |
| + |
| +export PYTHONPATH="/workspace/repo:${PYTHONPATH:-}" |
| + |
| +command -v xvfb-run >/dev/null 2>&1 \ |
| + || { echo "FAIL: xvfb-run is required for ManimGL rendering in this environment" >&2; exit 1; } |
| + |
| +MANIMGL_BIN=$(command -v manimgl || true) |
| +MANIM_RENDER_BIN=$(command -v manim-render || true) |
| +[ -n "$MANIMGL_BIN" ] || { echo "FAIL: manimgl not found after build" >&2; exit 1; } |
| +[ -n "$MANIM_RENDER_BIN" ] || { echo "FAIL: manim-render not found after build" >&2; exit 1; } |
| + |
| +ROOT=/workspace/repo/usercase-test-coderl |
| +SCENE="$ROOT/fixtures/open_flags_scene.py" |
| +TMP=$(mktemp -d) |
| +trap 'rm -rf "$TMP"' EXIT |
| +cd "$TMP" || exit 1 |
| +fail() { echo "FAIL: $*" >&2; exit 1; } |
| + |
| +mkdir -p "$TMP/bin" "$TMP/media" |
| +cat > "$TMP/bin/xdg-open" <<'SH' |
| +#!/usr/bin/env bash |
| +printf '%s\n' "$*" >> "$XDG_OPEN_LOG" |
| +exit 0 |
| +SH |
| +chmod +x "$TMP/bin/xdg-open" |
| +export PATH="$TMP/bin:$PATH" |
| +export XDG_OPEN_LOG="$TMP/xdg-open.log" |
| + |
| +run_render() { |
| + local bin="$1" |
| + shift |
| + : > "$XDG_OPEN_LOG" |
| + rm -rf "$TMP/media" |
| + mkdir -p "$TMP/media" |
| + xvfb-run -a "$bin" "$SCENE" EmptyScene "$@" -r 16x16 --fps 1 --quiet >out 2>err |
| + ec=$? |
| +} |
| + |
| +assert_no_crash_output() { |
| + |
| + |
| + ! grep -Eiq 'Traceback|SyntaxError|Exception:' out err \ |
| + || fail "$1 unexpected crash output: stdout=$(cat out) stderr=$(cat err)" |
| +} |
| + |
| +help_block_for() { |
| + grep -A1 -F -- "$1" out | tr '[:upper:]' '[:lower:]' |
| +} |
| + |
| +assert_finder_log_reveals() { |
| + local label="$1" |
| + local file="$2" |
| + local dir |
| + dir=$(dirname "$file") |
| + local log |
| + log=$(cat "$XDG_OPEN_LOG") |
| + |
| + |
| + |
| + case "$log" in |
| + "-R $file"|"--reveal $file"|"--select $file"|"$dir") ;; |
| + *) fail "$label opener log: $log" ;; |
| + esac |
| +} |
| + |
| + |
| + |
| + |
| +"$MANIMGL_BIN" --help >out 2>err; ec=$? |
| +[ "$ec" -eq 0 ] || fail "F1 exit $ec; want 0" |
| + |
| + |
| +open_help=$(help_block_for "--open") |
| +printf '%s\n' "$open_help" | grep -Fq -- "--open" || fail "F1 missing --open help" |
| +printf '%s\n' "$open_help" | grep -Eq -- '(^|[[:space:]])-o([,[:space:]]|$)' \ |
| + || fail "F1 missing -o help alias" |
| +printf '%s\n' "$open_help" | grep -Eq -- '(open|launch).*(saved|output|file)|(saved|output|file).*(open|launch)' \ |
| + || fail "F1 --open help does not describe opening the saved file" |
| + |
| + |
| +finder_help=$(help_block_for "--finder") |
| +printf '%s\n' "$finder_help" | grep -Fq -- "--finder" || fail "F1 missing --finder help" |
| +printf '%s\n' "$finder_help" | grep -Eq -- '(show|reveal|browser|file manager|file explorer)' \ |
| + || fail "F1 --finder help does not describe showing/revealing output" |
| +printf '%s\n' "$finder_help" | grep -Eq -- '(output|file|directory|folder)' \ |
| + || fail "F1 --finder help does not mention the output file/location" |
| +assert_no_crash_output F1 |
| + |
| + |
| + |
| + |
| +run_render "$MANIMGL_BIN" --open --video_dir "$TMP/media" --file_name opened_movie |
| +[ "$ec" -eq 0 ] || fail "F2 exit $ec; want 0" |
| +assert_no_crash_output F2 |
| +[ -f "$TMP/media/opened_movie.mp4" ] || fail "F2 missing movie file" |
| +[ "$(cat "$XDG_OPEN_LOG")" = "$TMP/media/opened_movie.mp4" ] \ |
| + || fail "F2 opener log: $(cat "$XDG_OPEN_LOG")" |
| + |
| + |
| + |
| + |
| +run_render "$MANIMGL_BIN" -o --video_dir "$TMP/media" --file_name short_open_movie |
| +[ "$ec" -eq 0 ] || fail "F3 exit $ec; want 0" |
| +assert_no_crash_output F3 |
| +[ -f "$TMP/media/short_open_movie.mp4" ] || fail "F3 missing movie file" |
| +[ "$(cat "$XDG_OPEN_LOG")" = "$TMP/media/short_open_movie.mp4" ] \ |
| + || fail "F3 opener log: $(cat "$XDG_OPEN_LOG")" |
| + |
| + |
| + |
| + |
| +run_render "$MANIMGL_BIN" --finder --video_dir "$TMP/media" --file_name revealed_movie |
| +[ "$ec" -eq 0 ] || fail "F4 exit $ec; want 0" |
| +assert_no_crash_output F4 |
| +[ -f "$TMP/media/revealed_movie.mp4" ] || fail "F4 missing movie file" |
| +assert_finder_log_reveals F4 "$TMP/media/revealed_movie.mp4" |
| + |
| + |
| + |
| + |
| +run_render "$MANIMGL_BIN" --open --skip_animations --video_dir "$TMP/media" --file_name opened_image |
| +[ "$ec" -eq 0 ] || fail "F5 exit $ec; want 0" |
| +assert_no_crash_output F5 |
| +[ -f "$TMP/media/opened_image.png" ] || fail "F5 missing image file" |
| +[ ! -e "$TMP/media/opened_image.mp4" ] || fail "F5 unexpectedly wrote a movie" |
| +[ "$(cat "$XDG_OPEN_LOG")" = "$TMP/media/opened_image.png" ] \ |
| + || fail "F5 opener log: $(cat "$XDG_OPEN_LOG")" |
| + |
| + |
| + |
| + |
| +run_render "$MANIM_RENDER_BIN" --finder --skip_animations --video_dir "$TMP/media" --file_name revealed_image |
| +[ "$ec" -eq 0 ] || fail "F6 exit $ec; want 0" |
| +assert_no_crash_output F6 |
| +[ -f "$TMP/media/revealed_image.png" ] || fail "F6 missing image file" |
| +[ ! -e "$TMP/media/revealed_image.mp4" ] || fail "F6 unexpectedly wrote a movie" |
| +assert_finder_log_reveals F6 "$TMP/media/revealed_image.png" |
| + |
| + |
| + |
| + |
| +run_render "$MANIM_RENDER_BIN" --open --video_dir "$TMP/media" --file_name render_cmd_movie |
| +[ "$ec" -eq 0 ] || fail "F7 exit $ec; want 0" |
| +assert_no_crash_output F7 |
| +[ -f "$TMP/media/render_cmd_movie.mp4" ] || fail "F7 missing movie file" |
| +[ "$(cat "$XDG_OPEN_LOG")" = "$TMP/media/render_cmd_movie.mp4" ] \ |
| + || fail "F7 opener log: $(cat "$XDG_OPEN_LOG")" |
| + |
| + |
| + |
| + |
| +: > "$XDG_OPEN_LOG" |
| +printf 'this is not python !!!\n' > "$TMP/broken_scene.py" |
| +xvfb-run -a "$MANIMGL_BIN" "$TMP/broken_scene.py" --open --video_dir "$TMP/media" --file_name no_scene -r 16x16 --fps 1 --quiet >out 2>err |
| +ec=$? |
| +[ "$ec" -ne 0 ] || fail "F8 exit 0; want non-zero" |
| + |
| + |
| +[ ! -e "$TMP/media/no_scene.mp4" ] || fail "F8 unexpectedly wrote a movie" |
| +[ ! -e "$TMP/media/no_scene.png" ] || fail "F8 unexpectedly wrote an image" |
| +[ ! -s "$XDG_OPEN_LOG" ] || fail "F8 opener should not be called: $(cat "$XDG_OPEN_LOG")" |
| + |
| +echo "PASS" |
| +exit 0 |
| |
| new file mode 100755 |
| |
| |
| @@ -0,0 +1,12 @@ |
| +#!/usr/bin/env bash |
| + |
| + |
| + |
| + |
| +export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=4096" |
| +export MAVEN_OPTS="${MAVEN_OPTS:-} -Xmx3g -XX:+UseG1GC" |
| +export GRADLE_OPTS="${GRADLE_OPTS:-} -Xmx3g -XX:+UseG1GC" |
| +export TEST_JVM_OPTS="${TEST_JVM_OPTS:-} -Xmx3g" |
| +set -e |
| +cd /workspace/repo |
| +exec bash /workspace/repo/usercase-test-coderl/usecase.sh |
|
|