xref: /illumos-gate/usr/src/test/util-tests/tests/libnvpair_json/json_common.ksh (revision 97a9db610324e7db4393415018e0e737485a94cd)
1#!/bin/ksh
2#
3# This file and its contents are supplied under the terms of the
4# Common Development and Distribution License ("CDDL"), version 1.0.
5# You may only use this file in accordance with the terms of version
6# 1.0 of the CDDL.
7#
8# A full copy of the text of the CDDL should have accompanied this
9# source.  A copy of the CDDL is also available via the Internet at
10# http://www.illumos.org/license/CDDL.
11#
12
13#
14# Copyright (c) 2014, Joyent, Inc.
15#
16
17function complete {
18  if [[ "${PRINT_OUTPUT}" ]]; then
19    printf "%s\n" "${OUTPUT}"
20    exit 0
21  elif [[ "${OUTPUT}" == "${BASELINE}" ]]; then
22    printf "TEST PASS: %s\n" "$(basename $0)"
23    exit 0
24  else
25    printf "TEST FAIL: %s\n" "$(basename $0)"
26    printf "EXPECTED: %s\n" "${BASELINE}"
27    printf "ACTUAL:   %s\n" "${OUTPUT}"
28    exit 1
29  fi
30}
31