tests: add `src.ctf.fs` single field testing framework
[babeltrace.git] / tests / plugins / src.ctf.fs / field / test-field.sh
CommitLineData
10ba5f69
OD
1#!/bin/bash
2#
3# SPDX-License-Identifier: GPL-2.0-only
4#
5# Copyright (C) 2023 Efficios, Inc.
6
7SH_TAP=1
8
9if [[ -n ${BT_TESTS_SRCDIR:-} ]]; then
10 UTILSSH=$BT_TESTS_SRCDIR/utils/utils.sh
11else
12 UTILSSH=$(dirname "$0")/../../../utils/utils.sh
13fi
14
15# shellcheck source=../../../utils/utils.sh
16source "$UTILSSH"
17
18# Directory containing the plugin
19data_dir=$BT_TESTS_DATADIR/plugins/src.ctf.fs/field
20
21test_pass() {
22 local -r mp_path=$1
23 local -r output_dir=$(mktemp -d)
24
25 run_python "$BT_TESTS_PYTHON_BIN" "$data_dir/data_from_mp.py" "$mp_path" "$output_dir"
26
27 local -r res_path=$(mktemp)
28
29 bt_cli "$res_path" /dev/null --plugin-path="$data_dir" \
30 -c sink.test-text.single "$output_dir/trace"
31 bt_diff "$res_path" "$output_dir/expect"
32 ok $? "$mp_path"
33 rm -rf "$output_dir" "$res_path"
34}
35
36plan_tests 6
37
38for mp_path in "$data_dir"/ctf-1/pass-*.mp; do
39 test_pass "$mp_path"
40done
This page took 0.025545 seconds and 4 git commands to generate.