#!/bin/bash
#
# This test generates and collects historical test files.
#
# It is named so as it assumes to run on my (bv) account on my
# workstation named "haiku".

SHELL=bash

# Base path to each release, distinguished only by the rel number, and
# each configured via direnv.
release_base="$HOME/wrk/wct/rel"

scrdir="$(realpath $(dirname $BASH_SOURCE))"
topdir="$(realpath ${scrdir}/../..)"
curver="$(wire-cell --version)"

declare -a rels
for rel in $@ 20 21 22 23 24
do
    rels+=("${release_base}${rel}/toolkit")
done
rels+=("$topdir")


function direnv_cd() {
  cd "$1"
  eval "$(direnv export bash 2>/dev/null)"
}

function mrun () {
    for relpath in ${rels[*]}
    do
        direnv_cd "$relpath"
        $@
    done
}


mrun wire-cell --version
# mrun ./wcb install --notests -p
mrun $topdir/test/bats/bin/bats $topdir/gen/test/test-addnoise.bats
