Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienos.com/blob/main/tests/nc-rd.sh # aienos.com Source of www.aienos.com, served from my own hardware Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienos.com / tests / nc-rd.sh` 65 lines ยท 3563 bytes Raw Blame History 1 #!/bin/bash 2 # Negative controls for om/site/repos.om (the public repository table behind /switched-off/, 3 # which shows names only). Each case puts one bad input in place of a committed file, runs 4 # the generator, expects rc 70 with the named message, and restores the file. 5 # 6 # Run from the repository root after the build has made build/site: 7 # om/site/omc < om/site/build.om > build/build-tool && chmod +x build/build-tool 8 # build/build-tool om/site/modules.txt build/site 9 # tests/nc-rd.sh # RUN="taskset -c 2 nice -n 10" tests/nc-rd.sh to pin a core 10 # Exit status 0 only when every case gives the expected result. 11 set -u 12 cd "$(git rev-parse --show-toplevel)" || exit 2 13 [ -x build/site ] || { echo "nc-rd: build/site is missing; build it first" >&2; exit 2; } 14 RUN=${RUN:-} 15 RIDS=data/public-repos.md 16 OFF=public/switched-off/index.html 17 T=$(mktemp -d) || exit 2 18 cp "$RIDS" "$T/rids"; cp "$OFF" "$T/off" 19 restore() { cp "$T/rids" "$RIDS"; cp "$T/off" "$OFF"; } 20 trap 'restore; rm -rf "$T"' EXIT 21 STAMP=$(git log -1 --format=%cI) 22 23 # Values taken from the committed table, so the cases follow it. 24 row() { grep -m1 "^| $1 | " "$T/rids"; } 25 rid() { row "$1" | awk -F' [|] ' '{print $2}'; } 26 MV=$(rid omega-mv) 27 SITE=$(rid aienos.com) 28 [ -n "$MV" ] && [ -n "$SITE" ] && [ -n "$(rid cuda-crack)" ] || { echo "nc-rd: committed table lacks omega-mv, aienos.com or cuda-crack" >&2; exit 2; } 29 WRONG=${MV%?}$([ "${MV: -1}" = X ] && echo Y || echo X) 30 31 # add_row : the committed table with one row added after its last row. 32 add_row() { awk -v r="$2" '{ if (in_t && $0 !~ /^\|/) { print r; in_t = 0; done = 1 } print; if ($0 ~ /^\|---/ && !done) in_t = 1 } END { if (in_t && !done) print r }' "$T/rids" > "$1"; } 33 34 fails=0 35 # case