Initial main skeleton with a single example
[platform/upstream/SSAT.git] / ssat-api.sh
1 #!/usr/bin/env bash
2 ##
3 # @file ssat-api.sh
4 # @author MyungJoo Ham <myungjoo.ham@gmail.com>
5 # @date Jun 22 2018
6 # @license Apache-2.0
7 # @brief This is API set for SSAT (Shell Script Automated Tester)
8 #
9
10 Black='\033[0;30m'
11 DarkGray='\033[1;30m'
12 Red='\033[0;31m'
13 LightRed='\033[1;31m'
14 Green='\033[0;32m'
15 LightGreen='\033[1;32m'
16 Orange='\033[0;33m'
17 Yellow='\033[1;33m'
18 Blue='\033[0;34m'
19 LightBlue='\033[1;34m'
20 Purple='\033[0;35m'
21 LightPurple='\033[1;35m'
22 Cyan='\033[0;36m'
23 LightCyan='\033[1;36m'
24 LightGray='\033[0;37m'
25 White='\033[1;37m'
26 NC='\033[0m'
27
28 ##
29 # @brief Report results of a test group (a "runTest.sh" in a testee directory)
30 # @param $1 # total test cases
31 # @param $2 # total success cases
32 # @param $3 # test log
33 # @param $4 # print outs from test (stdout)
34 #
35 function report {
36         echo NYI
37 }
38
39 ##
40 # @brief Write Test Log
41 # @param $1 1 = success / 0 = fail
42 # @param $2 test case ID (short string)
43 # @param $3 test case description
44 function testResult {
45         echo NYI
46 }
47
48 ##
49 # @brief Call Test Case (a shell script), expected exit = 0
50 # @param $1 Full path to the executable (e.g., ~/script/a1.sh)
51 # @param $2 Full string of the arguments to $1 (e.g., "-q -n --dryrun")
52 # @param $3 test case ID
53 # @param $4 test case description
54 function callTestSuccess {
55         echo NYI
56 }
57
58 ##
59 # @brief Call Test Case (a shell script), expected exit != 0
60 # @param $1 Full path to the executable (e.g., ~/script/a1.sh)
61 # @param $2 Full string of the arguments to $1 (e.g., "-q -n --dryrun")
62 # @param $3 test case ID
63 # @param $4 test case description
64 function callTestFail {
65         echo NYI
66 }
67
68 ##
69 # @brief Call Test Case (a shell script), expected exit == $5
70 # @param $1 Full path to the executable (e.g., ~/script/a1.sh)
71 # @param $2 Full string of the arguments to $1 (e.g., "-q -n --dryrun")
72 # @param $3 test case ID
73 # @param $4 test case description
74 # @param $5 Expected exit code.
75 function callTestExitEq {
76         echo NYI
77 }
78
79 ##
80 # @brief Compare two result files expected to be equal
81 # @param $1 Path to result 1 (golden)
82 # @param $2 Path to result 2 (test run)
83 # @param $3 test case ID
84 # @param $4 test case description
85 # @param $5 0 if the size is expected to be equal as well. 1 if golden (result 1) might be smaller (will ignore rest of result 2). 2 if the opposite of 1. If $5 > 2, it denotes the max size of compared bytes. (compare the first $5 bytes only)
86 function callCompareTest {
87         echo NYI
88 }
89
90 SSATAPILOADED=1