1f08c3bdfSopenharmony_ci#!/bin/sh
2f08c3bdfSopenharmony_ci# Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
3f08c3bdfSopenharmony_ci#
4f08c3bdfSopenharmony_ci# This program is free software; you can redistribute it and/or
5f08c3bdfSopenharmony_ci# modify it under the terms of the GNU General Public License as
6f08c3bdfSopenharmony_ci# published by the Free Software Foundation; either version 2 of
7f08c3bdfSopenharmony_ci# the License, or (at your option) any later version.
8f08c3bdfSopenharmony_ci#
9f08c3bdfSopenharmony_ci# This program is distributed in the hope that it would be useful,
10f08c3bdfSopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of
11f08c3bdfSopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12f08c3bdfSopenharmony_ci# GNU General Public License for more details.
13f08c3bdfSopenharmony_ci#
14f08c3bdfSopenharmony_ci# You should have received a copy of the GNU General Public License
15f08c3bdfSopenharmony_ci# along with this program. If not, see <http://www.gnu.org/licenses/>.
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ci. test.sh
18f08c3bdfSopenharmony_ci
19f08c3bdfSopenharmony_ciTST_CLEANUP=tst_rmdir
20f08c3bdfSopenharmony_ci
21f08c3bdfSopenharmony_cidns_check_answer()
22f08c3bdfSopenharmony_ci{
23f08c3bdfSopenharmony_ci	local fname="$1"
24f08c3bdfSopenharmony_ci
25f08c3bdfSopenharmony_ci	if ! grep -q 'status: NOERROR' $fname; then
26f08c3bdfSopenharmony_ci		cat $fname
27f08c3bdfSopenharmony_ci		tst_brkm TFAIL "unexpected query status"
28f08c3bdfSopenharmony_ci	fi
29f08c3bdfSopenharmony_ci	if ! grep -q 'QUERY: 1, ANSWER: 1' $fname; then
30f08c3bdfSopenharmony_ci		cat $fname
31f08c3bdfSopenharmony_ci		tst_brkm TFAIL "unexpected number of query/answer"
32f08c3bdfSopenharmony_ci	fi
33f08c3bdfSopenharmony_ci}
34f08c3bdfSopenharmony_ci
35f08c3bdfSopenharmony_cidns_check_send_requests()
36f08c3bdfSopenharmony_ci{
37f08c3bdfSopenharmony_ci	[ $num -eq $connect_quantity ] && return
38f08c3bdfSopenharmony_ci	tst_brkm TFAIL "some requests failed: $num/$connect_quantity"
39f08c3bdfSopenharmony_ci}
40f08c3bdfSopenharmony_ci
41f08c3bdfSopenharmony_citst_tmpdir
42