From e5c22aaf01484e7fa5926952bbcacd56228dbb64 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 28 May 2013 19:33:44 -0600 Subject: librechroot: fix typos, add unit test --- src/chroot-tools/librechroot | 4 ++-- test/librechroot-test.sh | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 test/librechroot-test.sh diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index ed00688..0fd621b 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -32,7 +32,7 @@ normshell() ( "$@" ) -make_emtpy_repo() { +make_empty_repo() { local copydir=$1 mkdir -p "${copydir}/repo" bsdtar -czf "${copydir}/repo/repo.db.tar.gz" -T /dev/null @@ -175,7 +175,7 @@ main() { set +u # if archroot_args is empty, it counts as unbound archroot "${archroot_args[@]}" -m "$rootdir" base-devel set -u - make_empty_repo "$copydir" + make_empty_repo "$rootdir" fi if [[ ! -d $copydir ]] || [[ $mode == sync ]]; then diff --git a/test/librechroot-test.sh b/test/librechroot-test.sh new file mode 100644 index 0000000..d8f7299 --- /dev/null +++ b/test/librechroot-test.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env roundup + +describe librechroot + +before() { + tmpdir=$(mktemp -d --tmpdir test-librechroot.XXXXXXXXXXXX) + mkdir -p "$XDG_CONFIG_HOME"/libretools + echo "CHROOTDIR='$tmpdir'" > "$XDG_CONFIG_HOME"/libretools/chroot.conf +} + +after() { + rm -rf -- "$tmpdir" "$XDG_CONFIG_HOME" +} + +it_creates_repo_for_new_chroots() { + sudo librechroot run test -r /repo/repo.db +} -- cgit v1.2.3-54-g00ecf