Browse Source

Add some bin/compile script scenarios

master
Susan Potter 10 years ago
parent
commit
02f302f3a1
  1. 4
      bin/compile
  2. 31
      features/compile.feature
  3. 5
      features/step_definitions/core.rb

4
bin/compile

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

31
features/compile.feature

@ -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

5
features/step_definitions/core.rb

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