blob: 69e8c0abdba49fdff64dc44804d7d52e99598a68 [file] [log] [blame]
Dean Troyer489bd2a2012-03-02 10:44:29 -06001#!/usr/bin/env bash
2
3# Tests for DevStack functions
4
5TOP=$(cd $(dirname "$0")/.. && pwd)
6
7# Import common functions
8source $TOP/functions
9
10# Import configuration
11source $TOP/openrc
12
13
Dean Troyer489bd2a2012-03-02 10:44:29 -060014echo "Testing die_if_not_set()"
15
Dean Troyer27e32692012-03-16 16:16:56 -050016bash -cx "source $TOP/functions; X=`echo Y && true`; die_if_not_set X 'not OK'"
Dean Troyer489bd2a2012-03-02 10:44:29 -060017if [[ $? != 0 ]]; then
18 echo "die_if_not_set [X='Y' true] Failed"
19else
20 echo 'OK'
21fi
22
Dean Troyer27e32692012-03-16 16:16:56 -050023bash -cx "source $TOP/functions; X=`true`; die_if_not_set X 'OK'"
Dean Troyer489bd2a2012-03-02 10:44:29 -060024if [[ $? = 0 ]]; then
25 echo "die_if_not_set [X='' true] Failed"
26fi
27
Dean Troyer27e32692012-03-16 16:16:56 -050028bash -cx "source $TOP/functions; X=`echo Y && false`; die_if_not_set X 'not OK'"
Dean Troyer489bd2a2012-03-02 10:44:29 -060029if [[ $? != 0 ]]; then
30 echo "die_if_not_set [X='Y' false] Failed"
31else
32 echo 'OK'
33fi
34
Dean Troyer27e32692012-03-16 16:16:56 -050035bash -cx "source $TOP/functions; X=`false`; die_if_not_set X 'OK'"
Dean Troyer489bd2a2012-03-02 10:44:29 -060036if [[ $? = 0 ]]; then
37 echo "die_if_not_set [X='' false] Failed"
38fi
39