1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3#
4# vmcp tool and module test
5#
6# The tool allows Linux users to send commands to the z/VM control program (CP).
7# The normal usage is to invoke vmcp with the command you want to execute.
8#
9# The test case contains one shell script:
10#
11# basically executes the vmcp tool with different parameters and verifies that
12# output and exitcodes are as expected
13
14TST_CNT=2
15TST_TESTFUNC=vmcp_main
16TST_NEEDS_CMDS="vmcp"
17. tst_test.sh
18
19vmcp_run()
20{
21
22        $2
23        if [ $? -eq $1 ]; then
24            tst_res TPASS "'$2' returned '$1'"
25        else
26            tst_res TFAIL "'$2' did not return '$1'"
27        fi
28}
29
30vmcp_main1()
31{
32        tst_res TINFO "Verify basic VMCP commands"
33        vmcp_run 0 "vmcp --version";
34        vmcp_run 0 "vmcp --help";
35        vmcp_run 0 "vmcp -v";
36        vmcp_run 0 "vmcp -h";
37        vmcp_run 0 "vmcp q dasd";
38}
39
40vmcp_main2()
41{
42        tst_res TINFO "Verify error conditions"
43        vmcp_run 4 "vmcp -L"
44        vmcp_run 4 "vmcp -m q dasd"
45        vmcp_run 1 "vmcp dasddasddasd"
46}
47
48
49tst_run
50