diff --git a/.travis.yml b/.travis.yml index e09143c..cfd7148 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,20 +13,18 @@ archlinux: mount: - ~/.ccache:~/.ccache - ~/.pkg-cache:/var/cache/pacman/pkg - repos: - - bartus=https://github.com/bartoszek/AUR-repo/raw/master packages: - # pacman packages - - git - - ccache - - haveged + # Pacman packages - aws-cli + - ccache + - git + - haveged before_install: -# 1.Override `package-cleanup.hook` to preserve cache for travis. -# 2.Enable ccache -# 3.Multithreaded build and compress -# 4.Suppress all gcc warnings + # 1.Override `package-cleanup.hook` to preserve cache for travis. + # 2.Enable ccache + # 3.Multithreaded build and compress + # 4.Suppress all gcc warnings - | sudo mkdir /etc/pacman.d/hooks/ sudo ln -s /dev/null /etc/pacman.d/hooks/package-cleanup.hook @@ -35,44 +33,51 @@ archlinux: sudo sed -i '/^COMPRESSXZ/s/\xz/xz -T 2/' /etc/makepkg.conf sudo sed -i '$a CFLAGS="$CFLAGS -w"' /etc/makepkg.conf sudo sed -i '$a CXXFLAGS="$CXXFLAGS -w"' /etc/makepkg.conf - # TODO this is not used script: - - "./bin/junest build -n" + - ./bin/junest build -n + + +env: + - TRAVIS_BASH_VERSION="4.0" + +before_install: + - ./tests/integ-tests/install-bash.sh "$TRAVIS_BASH_VERSION" + +install: + - PATH=$PWD/bin:$PATH script: -- "curl -s https://raw.githubusercontent.com/bartoszek/arch-travis/master/arch-travis.sh | bash" -- "echo pacman pkg cache size: $(du -h ~/.pkg-cache|cut -f1) in $(ls ~/.pkg-cache|wc -l) files" + ####################### + # Unit Tests + ####################### + - bash --version + - bash ./tests/checkstyle/checkstyle.sh + - bash ./tests/unit-tests/unit-tests.sh + # ARM with qemu does seem to work properly. Disabling integ tests for ARM for now. + #- export JUNEST_HOME=~/.junest-arm + #- junest proot --fakeroot -- ${PWD}/lib/checks/check.sh --skip-aur-tests + #- junest proot -- ${PWD}/lib/checks/check.sh --skip-aur-tests --use-sudo + #- yes | junest setup --delete + ####################### + # Build and validation tests + ####################### + - "curl -s https://raw.githubusercontent.com/bartoszek/arch-travis/master/arch-travis.sh | bash" + - "echo pacman pkg cache size: $(du -h ~/.pkg-cache|cut -f1) in $(ls ~/.pkg-cache|wc -l) files" + - ls -l + - pwd -#language: bash - -#sudo: required - -#env: - #- TRAVIS_BASH_VERSION="4.0" - -#before_install: - #- ./tests/integ-tests/install-bash.sh "$TRAVIS_BASH_VERSION" - -#install: - #- PATH=$PWD/bin:$PATH + # TODO Test the new created JuNest image against Ubuntu host #- junest setup #- junest -- echo "Installing JuNest (\$(uname -m))" #- JUNEST_HOME=~/.junest-arm junest setup --arch arm #- JUNEST_HOME=~/.junest-arm junest proot --fakeroot -- echo "Installing JuNest (\$(uname -m))" + - export JUNEST_HOME=~/.junest + - junest setup -i junest-x86_64.tar.gz + - ${PWD}/lib/checks/check_all.sh + - yes | junest setup --delete -#script: - #- bash --version - #- bash ./tests/checkstyle/checkstyle.sh - #- bash ./tests/unit-tests/unit-tests.sh + # TODO test deployed image can be downloaded correctly - #- export JUNEST_HOME=~/.junest - #- ${PWD}/lib/checks/check_all.sh - #- yes | junest setup --delete - ## ARM with qemu does seem to work properly. Disabling integ tests for ARM for now. - ##- export JUNEST_HOME=~/.junest-arm - ##- junest proot --fakeroot -- ${PWD}/lib/checks/check.sh --skip-aur-tests - ##- junest proot -- ${PWD}/lib/checks/check.sh --skip-aur-tests --use-sudo - ##- yes | junest setup --delete diff --git a/lib/checks/check.sh b/lib/checks/check.sh index 57dea5f..6ae3e6a 100755 --- a/lib/checks/check.sh +++ b/lib/checks/check.sh @@ -80,7 +80,11 @@ $SUDO pacman $PACMAN_OPTIONS -Rsn ${repo_package1} repo_package2=iftop info "Checking ${repo_package2} package from official repo..." $SUDO pacman $PACMAN_OPTIONS -S ${repo_package2} -$RUN_ROOT_TESTS && $SUDO iftop -t -s 5 +if $RUN_ROOT_TESTS +then + # Time it out given that sometimes it gets stuck after few seconds. + $SUDO timeout 10 iftop -t -s 5 || true +fi $SUDO pacman $PACMAN_OPTIONS -Rsn ${repo_package2} if ! $SKIP_AUR_TESTS diff --git a/lib/checks/check_all.sh b/lib/checks/check_all.sh index 6e28ee5..91bc058 100755 --- a/lib/checks/check_all.sh +++ b/lib/checks/check_all.sh @@ -8,10 +8,11 @@ set -ex JUNEST_BASE="${JUNEST_BASE:-$(readlink -f $(dirname $(readlink -f "$0"))/../..)}" JUNEST_SCRIPT=${JUNEST_SCRIPT:-${JUNEST_BASE}/bin/junest} + CHECK_SCRIPT=${JUNEST_BASE}/lib/checks/check.sh -$JUNEST_SCRIPT proot --fakeroot -- "$CHECK_SCRIPT" --skip-aur-tests -$JUNEST_SCRIPT proot -- "$CHECK_SCRIPT" --skip-aur-tests --use-sudo -$JUNEST_SCRIPT ns --fakeroot -- "$CHECK_SCRIPT" --skip-aur-tests -$JUNEST_SCRIPT ns -- "$CHECK_SCRIPT" --use-sudo -sudo -E $JUNEST_SCRIPT groot -- "$CHECK_SCRIPT" --run-root-tests --skip-aur-tests +$JUNEST_SCRIPT proot --fakeroot --backend-args "-b ${JUNEST_BASE}" -- "$CHECK_SCRIPT" --skip-aur-tests +$JUNEST_SCRIPT proot --backend-args "-b ${JUNEST_BASE}" -- "$CHECK_SCRIPT" --skip-aur-tests --use-sudo +$JUNEST_SCRIPT ns --backend-args "--bind ${JUNEST_BASE} ${JUNEST_BASE}" --fakeroot -- "$CHECK_SCRIPT" --skip-aur-tests +$JUNEST_SCRIPT ns --backend-args "--bind ${JUNEST_BASE} ${JUNEST_BASE}" -- "$CHECK_SCRIPT" --use-sudo +sudo -E $JUNEST_SCRIPT groot --backend-args "--bind ${JUNEST_BASE}" -- "$CHECK_SCRIPT" --run-root-tests --skip-aur-tests diff --git a/lib/core/build.sh b/lib/core/build.sh index a3ed8bd..fb41ede 100644 --- a/lib/core/build.sh +++ b/lib/core/build.sh @@ -88,18 +88,14 @@ function build_image_env(){ sudo pacman --noconfirm --root ${maindir}/root -S sed gzip sudo ln -sf /usr/share/zoneinfo/posix/UTC ${maindir}/root/etc/localtime sudo bash -c "echo 'en_US.UTF-8 UTF-8' >> ${maindir}/root/etc/locale.gen" - sudo ${maindir}/root/bin/groot --no-umount ${maindir}/root locale-gen - #sudo mount --bind ${maindir}/root ${maindir}/root - #sudo arch-chroot ${maindir}/root locale-gen + sudo ${maindir}/root/bin/groot ${maindir}/root locale-gen sudo bash -c "echo LANG=\"en_US.UTF-8\" >> ${maindir}/root/etc/locale.conf" sudo pacman --noconfirm --root ${maindir}/root -Rsn gzip info "Setting up the pacman keyring (this might take a while!)..." # gawk command is required for pacman-key sudo pacman --noconfirm --root ${maindir}/root -S gawk - #TODO sudo mount --bind /dev ${maindir}/root/dev - #sudo ${maindir}/root/bin/groot --no-umount -b /dev ${maindir}/root bash -c ' - sudo ${maindir}/root/bin/groot --no-umount ${maindir}/root bash -c ' + sudo ${maindir}/root/bin/groot --no-umount --avoid-bind -b /dev ${maindir}/root bash -c ' pacman-key --init; for keyring_file in /usr/share/pacman/keyrings/*.gpg; do @@ -107,7 +103,8 @@ function build_image_env(){ pacman-key --populate $keyring; done; [ -e /etc/pacman.d/gnupg/S.gpg-agent ] && gpg-connect-agent -S /etc/pacman.d/gnupg/S.gpg-agent killagent /bye' - sudo umount ${maindir}/root + sudo umount --force --recursive --lazy ${maindir}/root/dev + sudo umount --force --recursive ${maindir}/root sudo pacman --noconfirm --root ${maindir}/root -Rsn gawk sudo rm ${maindir}/root/var/cache/pacman/pkg/*