#!/bin/bash
###############################################################################
# Arcv-test
# 
# Copyright (c) 2026 Michel MEHL. All rights reserved. 
# 
# License terms written down in file LICENSE.txt
# Release file path: test_arcv
# Release file date: 2026-07-26 13:05
# App version: 1.0.1
# App source revision: 153
# App source signature: 2be56a9c9c90716e56960ba0fee106882c6f78f7e63cfbe5a31251166aa7cb54
# Source file last modification: 2026-07-22 20:37:36.003606166 +0200
#
# This header was generated. Do not modify.
#
# ------------------------------------------------------------------------------
#
#
# ------------------------------------------------------------------------------
# 
# Report bugs and suggestions: 
#     assistance@slashetc.fr
# 
# Specific or corporate requirements or extensions: 
#     info@slashetc.fr
# 
# The author is overall not required to provide maintenance or support 
# outside specific commercial terms agreed.
# 
###############################################################################

if [ ! -v ARCV_TEST_DIR ] ; then
    export ARCV_TEST_DIR="/usr/bin/arcv-test"
fi

if [ ! -d "${ARCV_TEST_DIR}" ] ; then
    echo "Error: ARCV_TEST_DIR=${ARCV_TEST_DIR} does not exist. Please set ARCV_TEST_DIR to a valid path" >&2
    exit -1
fi

if [ ! -v ARCV_DIR ] ; then
    export ARCV_DIR="/usr/bin/arcv"
    export SHELLAPI_DIR="/usr/bin/shell-api"
    export SHOTPLAN_DIR="/usr/bin/shotplan"
fi

if [ ! -d "${ARCV_DIR}" ] ; then
    echo "Error: ARCV_DIR=${ARCV_DIR} does not exist. Please set ARCV_DIR to a valid path" >&2
    exit -1
fi


# Ensure the correct executable is used
export PATH="${ARCV_DIR}:$PATH"
export PATH="${SHELLAPI_DIR}:$PATH"
export PATH="${SHOTPLAN_DIR}:$PATH"

#source "${ARCV_TEST_DIR}/local_test_vars.sh"
#local distro=$(lsb_release -a|awk -F ' ' '/^Description:/{printf ("%s-%s",$2,$3)}') 2>/dev/null
SYSENV="$(uname -srm)"
reportFile="test-report-arcv-$(arcv --version-num)-$(arcv --revision)-$(date +'%Y%m%d_%H%M')-${SYSENV}.txt"
shotplan "${ARCV_TEST_DIR}/shotplan.yml" $* | tee "${reportFile}"


