2020-03-29 08:54:11 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
export LUET_NOLOCK=true
|
|
|
|
|
|
|
|
oneTimeSetUp() {
|
|
|
|
export tmpdir="$(mktemp -d)"
|
|
|
|
}
|
|
|
|
|
|
|
|
oneTimeTearDown() {
|
|
|
|
rm -rf "$tmpdir"
|
|
|
|
}
|
|
|
|
|
|
|
|
testBuild() {
|
|
|
|
mkdir $tmpdir/testbuild
|
2020-04-03 13:06:27 +00:00
|
|
|
luet build --tree "$ROOT_DIR/tests/fixtures/versioning" --destination $tmpdir/testbuild --compression gzip --all
|
2020-03-29 08:54:11 +00:00
|
|
|
buildst=$?
|
2020-03-29 10:07:16 +00:00
|
|
|
assertEquals 'builds successfully' "0" "$buildst"
|
2020-03-29 09:40:11 +00:00
|
|
|
|
|
|
|
luet build --tree "$ROOT_DIR/tests/fixtures/versioning" --destination $tmpdir/testbuild --compression gzip media-libs/libsndfile
|
|
|
|
buildst=$?
|
2020-03-29 10:07:16 +00:00
|
|
|
assertEquals 'builds successfully' "0" "$buildst"
|
2020-03-29 09:40:11 +00:00
|
|
|
|
|
|
|
|
2020-11-29 11:02:46 +00:00
|
|
|
luet build --tree "$ROOT_DIR/tests/fixtures/versioning" --destination $tmpdir/testbuild --compression gzip '=dev-libs/libsigc++-2-2.10.1+1'
|
2020-03-29 09:40:11 +00:00
|
|
|
buildst=$?
|
2020-03-29 10:07:16 +00:00
|
|
|
assertEquals 'builds successfully' "0" "$buildst"
|
2020-03-29 08:54:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
testRepo() {
|
|
|
|
assertTrue 'no repository' "[ ! -e '$tmpdir/testbuild/repository.yaml' ]"
|
|
|
|
luet create-repo --tree "$ROOT_DIR/tests/fixtures/versioning" \
|
|
|
|
--output $tmpdir/testbuild \
|
|
|
|
--packages $tmpdir/testbuild \
|
|
|
|
--name "test" \
|
|
|
|
--descr "Test Repo" \
|
|
|
|
--urls $tmpdir/testrootfs \
|
|
|
|
--type disk > /dev/null
|
|
|
|
|
|
|
|
createst=$?
|
2020-03-29 10:07:16 +00:00
|
|
|
assertEquals 'create repo successfully' "0" "$createst"
|
2020-03-29 08:54:11 +00:00
|
|
|
assertTrue 'create repository' "[ -e '$tmpdir/testbuild/repository.yaml' ]"
|
|
|
|
}
|
|
|
|
|
|
|
|
testConfig() {
|
|
|
|
mkdir $tmpdir/testrootfs
|
|
|
|
cat <<EOF > $tmpdir/luet.yaml
|
|
|
|
general:
|
|
|
|
debug: true
|
|
|
|
system:
|
|
|
|
rootfs: $tmpdir/testrootfs
|
|
|
|
database_path: "/"
|
|
|
|
database_engine: "boltdb"
|
2020-11-07 18:14:44 +00:00
|
|
|
config_from_host: true
|
2020-03-29 08:54:11 +00:00
|
|
|
repositories:
|
|
|
|
- name: "main"
|
|
|
|
type: "disk"
|
|
|
|
enable: true
|
|
|
|
urls:
|
|
|
|
- "$tmpdir/testbuild"
|
|
|
|
EOF
|
|
|
|
luet config --config $tmpdir/luet.yaml
|
|
|
|
res=$?
|
2020-03-29 10:07:16 +00:00
|
|
|
assertEquals 'config test successfully' "0" "$res"
|
|
|
|
}
|
2020-03-29 08:54:11 +00:00
|
|
|
|
|
|
|
testInstall() {
|
2020-11-22 19:16:04 +00:00
|
|
|
luet install -y --config $tmpdir/luet.yaml media-libs/libsndfile
|
2020-03-29 08:54:11 +00:00
|
|
|
installst=$?
|
2020-03-29 10:07:16 +00:00
|
|
|
assertEquals 'install test successfully' "0" "$installst"
|
2020-03-29 08:54:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
testInstall2() {
|
2020-11-29 11:02:46 +00:00
|
|
|
luet install -y --config $tmpdir/luet.yaml '=dev-libs/libsigc++-2-2.10.1+1'
|
2020-03-29 08:54:11 +00:00
|
|
|
installst=$?
|
2020-03-29 10:07:16 +00:00
|
|
|
assertEquals 'install test successfully' "0" "$installst"
|
2020-03-29 08:54:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
testCleanup() {
|
|
|
|
luet cleanup --config $tmpdir/luet.yaml
|
|
|
|
installst=$?
|
2020-03-29 10:07:16 +00:00
|
|
|
assertEquals 'install test successfully' "0" "$installst"
|
2020-03-29 08:54:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Load shUnit2.
|
|
|
|
. "$ROOT_DIR/tests/integration/shunit2"/shunit2
|