forked from xwang2713/docker-hpcc-0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-platform.sh
executable file
·55 lines (43 loc) · 1.13 KB
/
test-platform.sh
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
#How to run:
#sudo docker run --rm -v "$PWD/test-image.sh:/usr/local/bin/test.sh" hpcc:<tag> test.sh
cd ~
mkdir -p tmp
cd tmp
# Start HPCC
/etc/init.d/hpcc-init start > /dev/null 2>&1
rc=$?
if [ $rc -ne 0 ]; then
echo "Start HPCC failed Error code: $rc"
exit 1
fi
cat > test.ecl << EOF
/*
Example code - use without restriction.
*/
Layout_Person := RECORD
UNSIGNED1 PersonID;
STRING15 FirstName;
STRING25 LastName;
END;
allPeople := DATASET([ {1,'Fred','Smith'},
{2,'Joe','Blow'},
{3,'Jane','Smith'}],Layout_Person);
somePeople := allPeople(LastName = 'Blow');
// Outputs ---
somePeople;
EOF
# Test ecl code through esp
/opt/HPCCSystems/bin/ecl run hthor test.ecl > test_result 2>&1
rc=$?
if [ $rc -ne 0 ]; then
echo "Test ecl code through esp failed! Error code: $rc"
exit 2
fi
# Validate result
cat test_result | grep "<Row><personid>2</personid><firstname>Joe[[:space:]]*</firstname><lastname>Blow[[:space:]]*</lastname></Row>" test_result > /dev/null
if [ $rc -ne 0 ]; then
echo "Test result validate failed!"
exit 3
fi
echo "ECL test through esp succeeded!"