commit 318113482116bbbd68c837de3a73a3d5d3ac0b46
parent dfe49b3807593593713055092fc7cd2c0139dc86
Author: Fred Großkopf <fred@kuandu.systems>
Date: Thu, 17 Sep 2026 22:52:17 +0200
Removes outdated tests
Diffstat:
| D | test-gitpages-regenerate.sh | | | 101 | ------------------------------------------------------------------------------- |
| D | test-gitpages.sh | | | 91 | ------------------------------------------------------------------------------- |
2 files changed, 0 insertions(+), 192 deletions(-)
diff --git a/test-gitpages-regenerate.sh b/test-gitpages-regenerate.sh
@@ -1,101 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2026 Fred Großkopf
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS; WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-set -eu
-
-SCRIPT_DIR=$(CDPATH= cd -- "$(dirname "$0")" && pwd)
-SCRIPT="$SCRIPT_DIR/gitpages-cmd.sh"
-
-# Configuration
-TEST_DIR=$(realpath "$(mktemp -d)")
-CONFIG_FILE="$TEST_DIR/gitpages.conf"
-GIT_SRC="$TEST_DIR/src"
-GIT_RAW="$TEST_DIR/raw"
-GIT_HTML="$TEST_DIR/git"
-ASSETS_DIR="$TEST_DIR/assets"
-GITPAGES_VAR_DIR="$TEST_DIR/var"
-
-export GITPAGES_VAR_DIR
-
-cleanup() {
- rm -rf "$TEST_DIR"
-}
-
-trap cleanup EXIT INT TERM
-
-# Mock dependencies so we don't need stagit installed.
-mkdir -p "$TEST_DIR/bin"
-export PATH="$TEST_DIR/bin:$PATH"
-
-mock_bin() {
- cat > "$TEST_DIR/bin/$1" <<EOF
-#!/bin/sh
-echo "MOCK: $1 called with \$*"
-exit 0
-EOF
- chmod +x "$TEST_DIR/bin/$1"
-}
-
-mock_bin stagit
-mock_bin stagit-index
-
-# Setup test environment
-mkdir -p \
- "$GIT_SRC" \
- "$GIT_RAW" \
- "$GIT_HTML" \
- "$ASSETS_DIR" \
- "$GITPAGES_VAR_DIR"
-
-# Create a real bare repository in GIT_SRC.
-#
-# The real mirror command will copy this repository to GIT_RAW.
-git init --bare "$GIT_SRC/myrepo.git" >/dev/null
-git --git-dir="$GIT_SRC/myrepo.git" \
- symbolic-ref HEAD refs/heads/main
-
-# Create test config
-cat > "$CONFIG_FILE" <<EOF
-WEB_ROOT=$TEST_DIR
-GIT_SRC=$GIT_SRC
-GIT_RAW=raw
-GIT_HTML=git
-ASSETS_DIR=$ASSETS_DIR
-EOF
-
-echo "Testing $SCRIPT generate"
-
-echo "=== Test: generate all repositories ==="
-
-"$SCRIPT" generate -c "$CONFIG_FILE"
-
-# The real mirror should have copied the repository.
-[ -d "$GIT_RAW/myrepo.git" ] || {
- echo "FAIL: myrepo.git was not mirrored" >&2
- exit 1
-}
-
-echo "PASS: myrepo.git was mirrored"
-
-# Generation should have created the repository HTML directory.
-[ -d "$GIT_HTML/myrepo" ] || {
- echo "FAIL: myrepo HTML directory was not generated" >&2
- exit 1
-}
-
-echo "PASS: myrepo HTML directory was generated"
-
-echo "All generate tests passed."
diff --git a/test-gitpages.sh b/test-gitpages.sh
@@ -1,91 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2026 Fred Großkopf
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-set -e
-
-# --- Configuration ---
-SCRIPT_NAME="./gitpages-cmd.sh"
-TEST_DIR=$(realpath "$(mktemp -d)")
-
-# --- Cleanup ---
-cleanup() {
- rm -rf "$TEST_DIR"
-}
-trap cleanup EXIT
-
-# --- Prerequisites ---
-[ -x "$SCRIPT_NAME" ] || {
- echo "ERROR: $SCRIPT_NAME missing or not executable"
- exit 1
-}
-command -v stagit-index > /dev/null 2>&1 || {
- echo "ERROR: stagit-index missing"
- exit 1
-}
-
-# --- Directory layout expected by gitpages.sh ---
-WEB_ROOT="$TEST_DIR/public"
-GIT_RAW_DIR="$WEB_ROOT/raw"
-GIT_HTML_DIR="$WEB_ROOT/html"
-STAGING_ROOT="$TEST_DIR/staging" # we'll point VAR_DIR here
-
-mkdir -p "$GIT_RAW_DIR" "$GIT_HTML_DIR" "$TEST_DIR/assets" "$STAGING_ROOT"
-
-# --- Dummy repo ---
-REPO_NAME="myrepo"
-REPO_DIR="$GIT_RAW_DIR/$REPO_NAME.git"
-mkdir -p "$REPO_DIR"
-(cd "$REPO_DIR" && git init --bare > /dev/null 2>&1)
-
-# --- Config (VAR_DIR now set here) ---
-CONFIG_FILE="$TEST_DIR/gitpages.conf"
-cat << EOF > "$CONFIG_FILE"
-WEB_ROOT=$WEB_ROOT
-GIT_HTML=html
-GIT_RAW=raw
-ASSETS_DIR=$TEST_DIR/assets
-EOF
-
-# --- Assets (for deploy_assets) ---
-echo "<!-- dummy logo -->" > "$TEST_DIR/assets/logo.svg"
-echo "<!-- dummy style -->" > "$TEST_DIR/assets/style.css"
-
-# --- Execution ---
-export GITPAGES_VAR_DIR="$TEST_DIR"
-echo "Running $SCRIPT_NAME generate on $REPO_DIR"
-"$SCRIPT_NAME" generate -c "$CONFIG_FILE" "$REPO_DIR"
-
-# --- Verification ---
-EXPECTED_REPO_DIR="$GIT_HTML_DIR/$REPO_NAME"
-EXPECTED_INDEX="$GIT_HTML_DIR/index.html"
-
-if [ -d "$EXPECTED_REPO_DIR" ] && [ -f "$EXPECTED_INDEX" ]; then
- echo "PASS: per‑repo HTML and index generated successfully"
-else
- echo "FAIL: missing repo or index"
- ls -R "$TEST_DIR"
- exit 1
-fi
-
-# --- Staging cleanup check ---
-STAGING_DIR="$TEST_DIR/staging/$REPO_NAME"
-if [ -d "$STAGING_DIR" ]; then
- echo "FAIL: staging directory still present at $STAGING_DIR"
- ls -R "$TEST_DIR/staging"
- exit 1
-fi
-
-echo "PASS: staging used and then cleaned up"