#!/bin/sh

# Copyright (C) 2018 Tommi Höynälänmaa
# Distributed under GNU General Public License version 3,
# see file doc/GPL-3.

examplesdir=$(get-theme-d-config-var examples-dir)
testsdir=$(get-theme-d-config-var tests-dir)
toolsdir=$(get-theme-d-config-var tools-dir)
targetdir=test-env

if [ -e $targetdir ] ; then
    echo "Target directory exists. Doing nothing." ;
    exit 1 ;
fi

if [ "$examplesdir" = "" -o "$testsdir" = "" -o "$toolsdir" = "" ] ; then
    echo "Directories could not be computed. Doing nothing." ;
    exit 1 ;
fi

mkdir $targetdir
mkdir $targetdir/testing
mkdir $targetdir/testing/output
mkdir $targetdir/theme-d-code
mkdir $targetdir/theme-d-code/examples
mkdir $targetdir/theme-d-code/tests

cp $toolsdir/check-test-compilation.scm $targetdir/testing/
cp $toolsdir/check-test-program-linking.scm $targetdir/testing/
cp $toolsdir/check-test-program-linking-racket.scm $targetdir/testing/
cp $toolsdir/check-test-runs.scm $targetdir/testing/
cp $toolsdir/check-test-runs-racket.scm $targetdir/testing/
cp $toolsdir/compile-tests.scm $targetdir/testing/
cp $toolsdir/link-test-programs.scm $targetdir/testing/
cp $toolsdir/link-test-programs-scheme.scm $targetdir/testing/
cp $toolsdir/link-test-programs-racket.scm $targetdir/testing/
cp $toolsdir/run-test-programs.scm $targetdir/testing/
cp $toolsdir/run-test-programs-racket.scm $targetdir/testing/
cp $toolsdir/run-test-programs-w-output.scm $targetdir/testing/
cp $toolsdir/run-test-programs-w-output-racket.scm $targetdir/testing/
cp $toolsdir/compare-output.sh $targetdir/testing/

cp $examplesdir/* $targetdir/theme-d-code/examples/
cp $testsdir/* $targetdir/theme-d-code/tests/

