Skip to content

Commit

Permalink
Add multi-shell test harness to run on each distro
Browse files Browse the repository at this point in the history
More eventually should be done with this but the basic operation of changing
/bin/sh, running the tests, and making it so the test results can be parsed is
there.  Adds shell installation instructions to provision process.
  • Loading branch information
thinkerbot authored and Simon Chiang committed Sep 26, 2014
1 parent 5da0c88 commit 6c06369
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -392,6 +392,11 @@ Clone the repo as above. To run the tests (written in `ts`):

ts test/suite

To run the tests on various distros:

vagrant up
./test/vm

To generate the manpages:

make manpages
Expand Down
5 changes: 5 additions & 0 deletions Vagrantfile
Expand Up @@ -7,21 +7,26 @@ VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :ubuntu do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, :path => "vm/ubuntu.sh"
end

config.vm.define :centos do |config|
config.vm.box = "chef/centos-6.5"
config.vm.provision :shell, :path => "vm/centos.sh"
end

config.vm.define :debian do |config|
config.vm.box = "chef/debian-7.4"
config.vm.provision :shell, :path => "vm/debian.sh"
end

config.vm.define :opensuse do |config|
config.vm.box = "chef/opensuse-13.1"
config.vm.provision :shell, :path => "vm/opensuse.sh"
end

config.vm.define :fedora do |config|
config.vm.box = "chef/fedora-20"
config.vm.provision :shell, :path => "vm/fedora.sh"
end
end
28 changes: 28 additions & 0 deletions test/shells
@@ -0,0 +1,28 @@
#!/bin/bash

if [ $# -eq 0 ]
then set bash dash zsh csh ksh
fi

#############################################################################
target_shell () {
ls -la $1 | awk '{ print $NF }'
}

if ! [ -e /bin/sh.bak ]
then sudo ln -sf $(target_shell /bin/sh) /bin/sh.bak
fi

for shell in "$@"
do
echo $shell
if [ -e /bin/$shell ]
then
sudo ln -sf $shell /bin/sh
./test/suite 2>&1 | sed -e 's/^/ /'
else
printf " skip\n"
fi
done

sudo ln -sf $(target_shell /bin/sh.bak) /bin/sh
2 changes: 1 addition & 1 deletion test/vm
Expand Up @@ -3,5 +3,5 @@
for box in $(vagrant status | awk '/running/ { print $1 }')
do
printf "%s\n" "$box"
vagrant ssh $box -c 'cd /vagrant; ./test/suite' 2>&1 | sed -e 's/^/ /'
vagrant ssh $box -c 'cd /vagrant; ./test/shells' 2>&1 | sed -e 's/^/ /'
done
2 changes: 2 additions & 0 deletions vm/centos.sh
@@ -0,0 +1,2 @@
#!/bin/sh
sudo yum install -y bash zsh csh ksh
2 changes: 2 additions & 0 deletions vm/debian.sh
@@ -0,0 +1,2 @@
#!/bin/sh
sudo apt-get install -y bash zsh csh ksh
2 changes: 2 additions & 0 deletions vm/fedora.sh
@@ -0,0 +1,2 @@
#!/bin/sh
sudo yum install -y bash zsh csh ksh
2 changes: 2 additions & 0 deletions vm/opensuse.sh
@@ -0,0 +1,2 @@
#!/bin/sh
sudo zypper install -y bash zsh ksh
2 changes: 2 additions & 0 deletions vm/ubuntu.sh
@@ -0,0 +1,2 @@
#!/bin/sh
sudo apt-get install -y bash zsh csh ksh

0 comments on commit 6c06369

Please sign in to comment.