#!/bin/bash # The MIT License (MIT) # # Copyright (C) 2026 Scott Duensing # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # run.sh -- the DVX package server's tests, as singemaster's are run: fixtures made, the server # started on a port of its own with a configuration of its own, the suites run against it, the # server stopped. Then both services in one calog process, each answering on its own port. # # server/test/run.sh (from anywhere; needs bin/host/dvxpkg from a DVX build, calog, and singemaster) # # calog and singemaster are beside this repository (../../calog and ../../singemaster from the # server folder) unless CALOG_HOME and SINGE_HOME say where they are; CALOG is the calog program # (CALOG_HOME/bin/calog unless it is set). # # CALOG_HOME=/opt/calog SINGE_HOME=/opt/singemaster server/test/run.sh # # Exit status 0 when every suite passed. set -u cd "$(dirname "$0")/.." || exit 1 CALOG_HOME=${CALOG_HOME:-$(cd ../../calog 2>/dev/null && pwd)} CALOG=${CALOG:-$CALOG_HOME/bin/calog} SINGE=${SINGE_HOME:-$(cd ../../singemaster 2>/dev/null && pwd)} DVXPKG=$(cd .. && pwd)/bin/host/dvxpkg PORT=18101 MASTER_PORT=18102 ADMIN=testoperatortoken0123456789abcdef DATA=$(pwd)/test/data # calog's library (its examples' web and mail servers) and singemaster's shared modules, and the # programs the run needs: said at once when they are not where they are looked for if [ -z "$CALOG_HOME" ] || [ ! -f "$CALOG_HOME/examples/httpd.lua" ]; then echo "calog is not beside this repository (set CALOG_HOME)"; exit 1 fi [ -x "$CALOG" ] || { echo "calog is not at $CALOG (set CALOG)"; exit 1; } if [ -z "$SINGE" ] || [ ! -f "$SINGE/lib/service.lua" ]; then echo "singemaster is not beside this repository (set SINGE_HOME)"; exit 1 fi [ -x "$DVXPKG" ] || { echo "the package tool is not at $DVXPKG (build DVX first)"; exit 1; } rm -rf "$DATA" && mkdir -p "$DATA/stage" # The repository's key pair (its secret stays here, as on the operator's computer) and a publisher's "$DVXPKG" keygen "DVX Test Repository" "$DATA/REPO" > /dev/null "$DVXPKG" keygen "Acme Test" "$DATA/ACME" > /dev/null # package