Move to kernel style SPDX license identifiers
[babeltrace.git] / tests / cli / list-plugins / test_list_plugins
CommitLineData
4a879f40
SM
1#!/bin/bash
2#
0235b0db 3# SPDX-License-Identifier: GPL-2.0-only
4a879f40 4#
0235b0db 5# Copyright (C) 2019 EfficiOS Inc.
4a879f40 6#
4a879f40
SM
7
8if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
9 UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
10else
11 UTILSSH="$(dirname "$0")/../../utils/utils.sh"
12fi
13
14# shellcheck source=../../utils/utils.sh
15SH_TAP=1 source "$UTILSSH"
16
17plan_tests 3
18
19data_dir="${BT_TESTS_DATADIR}/cli/list-plugins"
20plugin_dir="${data_dir}"
21
22stdout_file=$(mktemp -t test_cli_list_plugins_stdout.XXXXXX)
23stderr_file=$(mktemp -t test_cli_list_plugins_stderr.XXXXXX)
24grep_stdout_file=$(mktemp -t test_cli_list_plugins_grep_stdout.XXXXXX)
25py_plugin_expected_stdout_file=$(mktemp -t test_cli_list_plugins_expected_py_plugin_stdout.XXXXXX)
26
27# Run list-plugins.
28bt_cli "$stdout_file" "$stderr_file" \
29 --plugin-path "$plugin_dir" \
30 list-plugins
31ok "$?" "exit code is 0"
32
33# Extract the section about our custom this-is-a-plugin Python plugin.
34grep --after-context=11 '^this-is-a-plugin:$' "${stdout_file}" > "${grep_stdout_file}"
35ok "$?" "entry for this-is-a-plugin is present"
36
37if [ "$BT_OS_TYPE" = "mingw" ]; then
38 platform_plugin_dir=$(cygpath -m "${plugin_dir}")
39else
40 platform_plugin_dir="${plugin_dir}"
41fi
42
43# Generate the expected output file for that plugin.
44cat <<- EOF > "${py_plugin_expected_stdout_file}"
45 this-is-a-plugin:
46 Path: ${platform_plugin_dir}/bt_plugin_list_plugins.py
47 Version: 1.2.3bob
48 Description: A plugin
49 Author: Jorge Mario Bergoglio
50 License: The license
51 Source component classes:
52 'source.this-is-a-plugin.ThisIsASource'
53 Filter component classes:
54 'filter.this-is-a-plugin.ThisIsAFilter'
55 Sink component classes:
56 'sink.this-is-a-plugin.ThisIsASink'
57EOF
58
59# Compare the entry for this-is-a-plugin with the expected version.
60bt_diff "${py_plugin_expected_stdout_file}" "${grep_stdout_file}"
61ok "$?" "entry for this-is-a-plugin is as expected"
62
63rm -f "${stdout_file}"
64rm -f "${stderr_file}"
65rm -f "${grep_stdout_file}"
66rm -f "${py_plugin_expected_stdout_file}"
This page took 0.027414 seconds and 4 git commands to generate.