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