aboutsummaryrefslogtreecommitdiffstats
path: root/tests/list
blob: 7fb4891b5d2b905c3fe725fb2513aec77a4b493f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash

init list

# setup test configs
echo "Test 1" > $BIN/test1.conf
echo "Test 2" > $BIN/test2.conf
echo "Test 3" > $BIN/test3.conf

function run_list {
    # add configs to ck
    path1=$BIN/test1.conf
    exec $BIN/ck conf $BIN add prog1 $path1 -p > /dev/null & 
    wait $!

    if [ $? -ne 0 ]; then
        echo -e $ERROR" ck crashed."
        exit 1
    fi

    path2=$BIN/test2.conf
    exec $BIN/ck conf $BIN add prog2 $path2 -s > /dev/null &
    wait $!

    if [ $? -ne 0 ]; then
        echo -e $ERROR" ck crashed."
        exit 1
    fi

    path3=$BIN/test3.conf
    exec $BIN/ck conf $BIN add prog3 $path3 -p -s > /dev/null &
    wait $!

    if [ $? -ne 0 ]; then
        echo -e $ERROR" ck crashed."
        exit 1
    fi

    for i in $($BIN/ck conf $BIN list paths); do
        if [[ "$i" == "$path1" ]] || [[ "$i" == "$path2" ]] || [[ "$i" == "$path3" ]]; then
	    echo "path good";
	fi
    done

    for i in $($BIN/ck conf $BIN list programs); do
        if [[ "$i" == "prog1" ]] || [[ "$i" == "prog2" ]] || [[ "$i" == "prog3" ]]; then
	    echo "program good";
	fi
    done
}

run_list

clear_tests
echo -e $PASS