Files
mixer-tools/bat/lib/mixerlib.bash
T
Tudor Marcu 0a87d8cb91 Add BAT tests for mixer command-line testing
These tests should be reporting on the structure and correctness of mixer
and its user interface. Due to them running very slowly on the Travis CI
environment, they are not run by default, but can be run locally with
make batcheck.

This patch also introduces a docker container to do the build, so we do not
have to worry about running this in different environments such as Travis
CI. The tests are thus confined to a strict, well-known workspace,
and we can avoid many dependency problems.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2018-02-16 16:06:36 -08:00

76 lines
1.7 KiB
Bash
Executable File

# NOTE: source this file from a BATS test case file
# This library defines functions to use in the BATS test files during a local
# test run with 'make check'.
export cachedir="$HOME/.cache/mixer-tests"
logdir="$BATS_TEST_DIRNAME/logs"
BUNDLE_DIR="$BATS_TEST_DIRNAME/local-bundles"
CLRVER=$(curl https://download.clearlinux.org/latest)
CLR_BUNDLES="$BATS_TEST_DIRNAME/upstream-bundles/clr-bundles-$CLRVER/bundles"
BUNDLE_LIST="$BATS_TEST_DIRNAME/mixbundles"
mkdir -p $cachedir
mkdir -p $logdir
setup_builder_conf() {
:
}
localize_builder_conf() {
echo "LOCAL_RPM_DIR = $BATS_TEST_DIRNAME/local-rpms
LOCAL_REPO_DIR = $BATS_TEST_DIRNAME/local-yum" >> $BATS_TEST_DIRNAME/builder.conf
}
mixer-init-versions() {
sudo -E mixer init --clear-version $1 --mix-version $2 --new-swupd
}
clean-bundle-dir() {
sudo rm -rf $BUNDLE_DIR/*
echo -e "filesystem\n" | sudo tee $BUNDLE_DIR/os-core > /dev/null
}
mixer-build-chroots() {
sudo -E mixer build chroots --config $BATS_TEST_DIRNAME/builder.conf --new-swupd --new-chroots
}
mixer-create-update() {
sudo -E mixer build update --config $BATS_TEST_DIRNAME/builder.conf --new-swupd
}
mixer-add-rpms() {
mkdir -p ./local ./rpms
sudo -E mixer add-rpms --config $BATS_TEST_DIRNAME/builder.conf --new-swupd
}
add-bundle() {
sudo touch $BUNDLE_DIR/$1
}
add-package() {
echo $1 | sudo tee -a $BUNDLE_DIR/$2 > /dev/null
sudo mixer bundle add $2
}
add-clear-bundle() {
sudo cp $CLR_BUNDLES/$1 $BUNDLE_DIR
sudo mixer bundle add $1
}
remove-bundle() {
sudo sed -i "/$1/d" $BUNDLE_LIST
}
remove-package() {
sudo sed -i "/$1/d" $BUNDLE_DIR/$2
}
download-rpm() {
mkdir -p ./rpms
pushd rpms
sudo curl -O $1
popd
}
# vi: ft=sh ts=8 sw=2 sts=2 et tw=80