Add some bin/compile script scenarios

This commit is contained in:
Susan Potter 2012-02-18 02:35:00 -06:00
parent a354e6ef01
commit 02f302f3a1
3 changed files with 40 additions and 0 deletions

View file

@ -14,6 +14,10 @@ echo "Info: CACHE_DIR=$CACHE_DIR"
if [ "$BUILDPACK_GHC_BASE_URL" != "" ]; then if [ "$BUILDPACK_GHC_BASE_URL" != "" ]; then
arch=$(uname -m) arch=$(uname -m)
ghcver=$GHC_BOOTSTRAP_VERSION ghcver=$GHC_BOOTSTRAP_VERSION
if [ "$ghcver" == "" ]; then
echo "Error: please set GHC_BOOTSTRAP_VERSION";
exit 1;
fi;
bsdir=$CACHE_DIR/bootstrap bsdir=$CACHE_DIR/bootstrap
ghcurl="$BUILDPACK_GHC_BASE_URL/$ghcver/ghc-$ghcver-$arch-unknown-linux.tar.bz2" ghcurl="$BUILDPACK_GHC_BASE_URL/$ghcver/ghc-$ghcver-$arch-unknown-linux.tar.bz2"
echo "Info: bootstrap directory: ${bsdir}"; echo "Info: bootstrap directory: ${bsdir}";

31
features/compile.feature Normal file
View file

@ -0,0 +1,31 @@
Feature: Compile
In order to build and deploy an application
As the bin/compile script of the buildpack
I want to download and bootstrap the environment
Scenario: BUILDPACK_GHC_BASE_URL not set
Given environment variable BUILDPACK_GHC_BASE_URL is set to ""
When I run `compile ../tmp/build ../tmp/cache`
Then the output should contain "Error: please set BUILDPACK_GHC_BASE_URL"
And the exit status should be 1
Scenario: BUILDPACK_GHC_BASE_URL is set
Given environment variable BUILDPACK_GHC_BASE_URL is set to "http://www.haskell.org/ghc/dist"
When I run `compile ../tmp/build ../tmp/cache`
Then the output should not contain "Error: please set BUILDPACK_GHC_BASE_URL"
And the exit status should be 0
Scenario: GHC_BOOTSTRAP_VERSION is not set
Given environment variable GHC_BOOTSTRAP_VERSION is set to ""
Given environment variable BUILDPACK_GHC_BASE_URL is set to "http://www.haskell.org/ghc/dist"
When I run `compile ../tmp/build ../tmp/cache`
Then the output should contain "Error: please set GHC_BOOTSTRAP_VERSION"
And the exit status should be 1
Scenario: GHC_BOOTSTRAP_VERSION is set
Given environment variable GHC_BOOTSTRAP_VERSION is set to "7.0.4"
Given environment variable BUILDPACK_GHC_BASE_URL is set to "http://www.haskell.org/ghc/dist"
When I run `compile ../tmp/build ../tmp/cache`
Then the output should not contain "Error: please set GHC_BOOTSTRAP_VERSION"
And the exit status should be 0

View file

@ -0,0 +1,5 @@
Given /^environment variable (.*) is set to "([^"]*)"$/ do |name, value|
ENV[name]=value
end