+++ /dev/null
-# The MIT License (MIT)
-#
-# Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-barectf_assert_file_exists() {
- pushd "$BATS_TEST_DIRNAME"
-
- if [ ! -f "$1" ]; then
- echo "FATAL: "$1" does not exist" 1>&2
- return 1
- fi
-
- if ! which barectf > /dev/null; then
- echo "FATAL: cannot find barectf tool" 1>&2
- return 1
- fi
-
- run barectf "$1"
- popd
- return $status
-}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
+barectf_assert_file_exists() {
+ if [ ! -f "$1" ]; then
+ echo "FATAL: "$1" does not exist" 1>&2
+ return 1
+ fi
+
+ if ! which barectf > /dev/null; then
+ echo "FATAL: cannot find barectf tool" 1>&2
+ return 1
+ fi
+}
+
+barectf_config_check_success() {
+ pushd "$BATS_TEST_DIRNAME" >/dev/null
+
+ if ! barectf_assert_file_exists "$1"; then
+ popd >/dev/null
+ return 1
+ fi
+
+ run barectf "$1"
+ popd >/dev/null
+
+ if [ "$status" -ne 0 ]; then
+ echo "Fail: exit code is $status" 1>&2
+ return 1
+ fi
+}
+
barectf_config_check_fail() {
- if [ $status -eq 0 ]; then
+ pushd "$BATS_TEST_DIRNAME" >/dev/null
+
+ if ! barectf_assert_file_exists "$1"; then
+ popd >/dev/null
+ return 1
+ fi
+
+ run barectf "$1"
+
+ if [ "$status" -eq 0 ]; then
echo "Fail: exit code is 0" 1>&2
+ popd >/dev/null
return 1
fi
- pushd "$BATS_TEST_DIRNAME"
local find_output="$(find -iname '*.c' -o -iname '*.h' -o -iname metadata)"
- popd
+ popd >/dev/null
if [ -n "$find_output" ]; then
echo "Fail: barectf generated files" 1>&2
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'unknown property in clock object makes barectf fail' {
- barectf_assert_file_exists unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail unknown-prop.yaml
}
@test 'wrong "freq" property type in clock object makes barectf fail' {
- barectf_assert_file_exists freq-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail freq-invalid-type.yaml
}
@test 'invalid "freq" property (0) in clock object makes barectf fail' {
- barectf_assert_file_exists freq-0.yaml
- barectf_config_check_fail
+ barectf_config_check_fail freq-0.yaml
}
@test 'invalid "freq" property (negative) in clock object makes barectf fail' {
- barectf_assert_file_exists freq-neg.yaml
- barectf_config_check_fail
+ barectf_config_check_fail freq-neg.yaml
}
@test 'wrong "description" property type in clock object makes barectf fail' {
- barectf_assert_file_exists description-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail description-invalid-type.yaml
}
@test 'wrong "uuid" property type in clock object makes barectf fail' {
- barectf_assert_file_exists uuid-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail uuid-invalid-type.yaml
}
@test 'invalid "uuid" property in clock object makes barectf fail' {
- barectf_assert_file_exists uuid-invalid.yaml
- barectf_config_check_fail
+ barectf_config_check_fail uuid-invalid.yaml
}
@test 'wrong "error-cycles" property type in clock object makes barectf fail' {
- barectf_assert_file_exists ec-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ec-invalid-type.yaml
}
@test 'invalid "error-cycles" property in clock object makes barectf fail' {
- barectf_assert_file_exists ec-invalid.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ec-invalid.yaml
}
@test 'wrong "offset" property type in clock object makes barectf fail' {
- barectf_assert_file_exists offset-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail offset-invalid-type.yaml
}
@test 'wrong "absolute" property type in clock object makes barectf fail' {
- barectf_assert_file_exists absolute-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail absolute-invalid-type.yaml
}
@test 'unknown property in clock offset object makes barectf fail' {
- barectf_assert_file_exists offset-unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail offset-unknown-prop.yaml
}
@test 'wrong "seconds" property type in clock offset object makes barectf fail' {
- barectf_assert_file_exists offset-seconds-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail offset-seconds-invalid-type.yaml
}
@test 'invalid "seconds" property in clock offset object makes barectf fail' {
- barectf_assert_file_exists offset-seconds-neg.yaml
- barectf_config_check_fail
+ barectf_config_check_fail offset-seconds-neg.yaml
}
@test 'wrong "cycles" property type in clock offset object makes barectf fail' {
- barectf_assert_file_exists offset-cycles-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail offset-cycles-invalid-type.yaml
}
@test 'invalid "cycles" property in clock offset object makes barectf fail' {
- barectf_assert_file_exists offset-cycles-neg.yaml
- barectf_config_check_fail
+ barectf_config_check_fail offset-cycles-neg.yaml
}
@test 'wrong "$return-ctype" property type in clock object makes barectf fail' {
- barectf_assert_file_exists rct-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail rct-invalid-type.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'unknown property in config object makes barectf fail' {
- barectf_assert_file_exists unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail unknown-prop.yaml
}
@test 'no "version" property in config object makes barectf fail' {
- barectf_assert_file_exists version-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail version-no.yaml
}
@test 'wrong "version" property type in config object makes barectf fail' {
- barectf_assert_file_exists version-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail version-invalid-type.yaml
}
@test 'invalid "version" property (1.9) in config object makes barectf fail' {
- barectf_assert_file_exists version-invalid-19.yaml
- barectf_config_check_fail
+ barectf_config_check_fail version-invalid-19.yaml
}
@test 'invalid "version" property (2.3) in config object makes barectf fail' {
- barectf_assert_file_exists version-invalid-23.yaml
- barectf_config_check_fail
+ barectf_config_check_fail version-invalid-23.yaml
}
@test 'wrong "prefix" property type in config object makes barectf fail' {
- barectf_assert_file_exists prefix-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail prefix-invalid-type.yaml
}
@test 'no valid C identifier in "prefix" property type in config object makes barectf fail' {
- barectf_assert_file_exists prefix-invalid-identifier.yaml
- barectf_config_check_fail
+ barectf_config_check_fail prefix-invalid-identifier.yaml
}
@test 'no "metadata" property in config object makes barectf fail' {
- barectf_assert_file_exists metadata-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail metadata-no.yaml
}
@test 'wrong "metadata" property type in config object makes barectf fail' {
- barectf_assert_file_exists metadata-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail metadata-invalid-type.yaml
}
@test 'wrong "options" property type in config object makes barectf fail' {
- barectf_assert_file_exists options-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail options-invalid-type.yaml
}
@test 'wrong "gen-prefix-def" property type in config options object makes barectf fail' {
- barectf_assert_file_exists options-gen-prefix-def-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail options-gen-prefix-def-invalid-type.yaml
}
@test 'wrong "gen-default-stream-def" property type in config options object makes barectf fail' {
- barectf_assert_file_exists options-gen-default-stream-def-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail options-gen-default-stream-def-invalid-type.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'unknown property in event object makes barectf fail' {
- barectf_assert_file_exists unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail unknown-prop.yaml
}
@test 'wrong "log-level" property type in event object makes barectf fail' {
- barectf_assert_file_exists ll-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ll-invalid-type.yaml
}
@test 'non existing log level name as "log-level" property value in event object makes barectf fail' {
- barectf_assert_file_exists ll-non-existing.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ll-non-existing.yaml
}
@test 'wrong "context-type" property type in event object makes barectf fail' {
- barectf_assert_file_exists ct-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ct-invalid-type.yaml
}
@test 'invalid "context-type" property field type (not a structure) in event object makes barectf fail' {
- barectf_assert_file_exists ct-not-struct.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ct-not-struct.yaml
}
@test 'wrong "payload-type" property type in event object makes barectf fail' {
- barectf_assert_file_exists pt-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pt-invalid-type.yaml
}
@test 'invalid "payload-type" property field type (not a structure) in event object makes barectf fail' {
- barectf_assert_file_exists pt-not-struct.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pt-not-struct.yaml
}
@test 'empty event object makes barectf fail' {
- barectf_assert_file_exists no-fields-at-all.yaml
- barectf_config_check_fail
+ barectf_config_check_fail no-fields-at-all.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'wrong "$include" property type makes barectf fail' {
- barectf_assert_file_exists invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail invalid-type.yaml
}
@test 'non-existing file in "$include" property (string) makes barectf fail' {
- barectf_assert_file_exists file-not-found.yaml
- barectf_config_check_fail
+ barectf_config_check_fail file-not-found.yaml
}
@test 'non-existing absolute file in "$include" property (string) makes barectf fail' {
- barectf_assert_file_exists file-not-found-abs.yaml
- barectf_config_check_fail
+ barectf_config_check_fail file-not-found-abs.yaml
}
@test 'non-existing file in "$include" property (array) makes barectf fail' {
- barectf_assert_file_exists file-not-found-in-array.yaml
- barectf_config_check_fail
+ barectf_config_check_fail file-not-found-in-array.yaml
}
@test 'non-existing file in "$include" property (recursive) makes barectf fail' {
- barectf_assert_file_exists file-not-found-recursive.yaml
- barectf_config_check_fail
+ barectf_config_check_fail file-not-found-recursive.yaml
}
@test 'cycle in include graph makes barectf fail' {
- barectf_assert_file_exists cycle.yaml
- barectf_config_check_fail
+ barectf_config_check_fail cycle.yaml
}
@test 'cycle in include graph (with a symbolic link) makes barectf fail' {
local symlink="$BATS_TEST_DIRNAME/inc-recursive-sym3.yaml"
ln -fs inc-recursive-sym1.yaml "$symlink"
- barectf_assert_file_exists cycle-sym.yaml
- barectf_config_check_fail
+ barectf_config_check_fail cycle-sym.yaml
rm -f "$symlink"
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'unknown property in metadata object makes barectf fail' {
- barectf_assert_file_exists unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail unknown-prop.yaml
}
@test 'wrong "env" property type in metadata object makes barectf fail' {
- barectf_assert_file_exists env-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail env-invalid-type.yaml
}
@test 'invalid "env" key (invalid C identifier) in metadata object makes barectf fail' {
- barectf_assert_file_exists env-key-invalid-identifier.yaml
- barectf_config_check_fail
+ barectf_config_check_fail env-key-invalid-identifier.yaml
}
@test 'invalid "env" value (not an int/string) in metadata object makes barectf fail' {
- barectf_assert_file_exists env-value-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail env-value-invalid-type.yaml
}
@test 'wrong "clocks" property type in metadata object makes barectf fail' {
- barectf_assert_file_exists clocks-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail clocks-invalid-type.yaml
}
@test 'invalid "clocks" key (invalid C identifier) in metadata object makes barectf fail' {
- barectf_assert_file_exists clocks-key-invalid-identifier.yaml
- barectf_config_check_fail
+ barectf_config_check_fail clocks-key-invalid-identifier.yaml
}
@test 'wrong "$log-levels" property type in metadata object makes barectf fail' {
- barectf_assert_file_exists ll-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ll-invalid-type.yaml
}
@test 'wrong "$log-levels" property value type in metadata object makes barectf fail' {
- barectf_assert_file_exists ll-value-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ll-value-invalid-type.yaml
}
@test 'wrong "type-aliases" property type in metadata object makes barectf fail' {
- barectf_assert_file_exists ta-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ta-invalid-type.yaml
}
@test 'no "trace" property in metadata object makes barectf fail' {
- barectf_assert_file_exists trace-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail trace-no.yaml
}
@test 'wrong "trace" property type in metadata object makes barectf fail' {
- barectf_assert_file_exists trace-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail trace-invalid-type.yaml
}
@test 'empty "trace" property in metadata object makes barectf fail' {
- barectf_assert_file_exists trace-empty.yaml
- barectf_config_check_fail
+ barectf_config_check_fail trace-empty.yaml
}
@test 'no "streams" property in metadata object makes barectf fail' {
- barectf_assert_file_exists streams-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail streams-no.yaml
}
@test 'wrong "streams" property type in metadata object makes barectf fail' {
- barectf_assert_file_exists streams-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail streams-invalid-type.yaml
}
@test 'empty "streams" property in metadata object makes barectf fail' {
- barectf_assert_file_exists streams-empty.yaml
- barectf_config_check_fail
+ barectf_config_check_fail streams-empty.yaml
}
@test 'invalid "streams" key (invalid C identifier) in metadata object makes barectf fail' {
- barectf_assert_file_exists streams-key-invalid-identifier.yaml
- barectf_config_check_fail
+ barectf_config_check_fail streams-key-invalid-identifier.yaml
}
@test 'multiple streams in metadata object with missing "stream_id" packet header type field makes barectf fail' {
- barectf_assert_file_exists multiple-streams-trace-ph-no-stream-id.yaml
- barectf_config_check_fail
+ barectf_config_check_fail multiple-streams-trace-ph-no-stream-id.yaml
}
@test 'wrong "$default-stream" property type in metadata object makes barectf fail' {
- barectf_assert_file_exists default-stream-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail default-stream-invalid-type.yaml
}
@test 'non-existing stream name in "$default-stream" property makes barectf fail' {
- barectf_assert_file_exists default-stream-unknown-stream.yaml
- barectf_config_check_fail
+ barectf_config_check_fail default-stream-unknown-stream.yaml
}
@test 'coexisting "$default-stream" property (metadata) and "$default: true" property (stream) with different names make barectf fail' {
- barectf_assert_file_exists default-stream-stream-default-duplicate.yaml
- barectf_config_check_fail
+ barectf_config_check_fail default-stream-stream-default-duplicate.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'unknown property in stream object makes barectf fail' {
- barectf_assert_file_exists unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail unknown-prop.yaml
}
@test 'no "packet-context-type" property in stream object makes barectf fail' {
- barectf_assert_file_exists pct-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-no.yaml
}
@test 'wrong "packet-context-type" property type in stream object makes barectf fail' {
- barectf_assert_file_exists pct-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-invalid-type.yaml
}
@test 'invalid "packet-context-type" property field type (not a structure) in stream object makes barectf fail' {
- barectf_assert_file_exists pct-not-struct.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-not-struct.yaml
}
@test 'invalid "timestamp_begin" field type (not an integer) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-tb-not-int.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-tb-not-int.yaml
}
@test 'invalid "timestamp_begin" field type (signed) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-tb-wrong-signed.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-tb-wrong-signed.yaml
}
@test 'invalid "timestamp_begin" field type (not mapped to a clock) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-tb-wrong-pm.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-tb-wrong-pm.yaml
}
@test 'no "timestamp_begin" field with an existing "timestamp_end" field in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-te-yes-tb-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-te-yes-tb-no.yaml
}
@test 'invalid "timestamp_end" field type (not an integer) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-te-not-int.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-te-not-int.yaml
}
@test 'invalid "timestamp_end" field type (signed) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-te-wrong-signed.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-te-wrong-signed.yaml
}
@test 'invalid "timestamp_end" field type (not mapped to a clock) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-te-wrong-pm.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-te-wrong-pm.yaml
}
@test 'no "timestamp_end" field with an existing "timestamp_begin" field in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-tb-yes-te-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-tb-yes-te-no.yaml
}
@test '"timestamp_begin" field and "timestamp_end" field are not mapped to the same clock in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-tb-te-different-clocks.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-tb-te-different-clocks.yaml
}
@test 'invalid "packet_size" field type (not an integer) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-ps-not-int.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-ps-not-int.yaml
}
@test 'invalid "packet_size" field type (signed) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-ps-wrong-signed.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-ps-wrong-signed.yaml
}
@test 'no "packet_size" field with an existing "content_size" field in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-cs-yes-ps-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-cs-yes-ps-no.yaml
}
@test 'invalid "content_size" field type (not an integer) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-cs-not-int.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-cs-not-int.yaml
}
@test 'invalid "content_size" field type (signed) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-cs-wrong-signed.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-cs-wrong-signed.yaml
}
@test 'no "content_size" field with an existing "packet_size" field in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-ps-yes-cs-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-ps-yes-cs-no.yaml
}
@test '"content_size" field size greater than "packet_size" field size in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-cs-gt-ps.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-cs-gt-ps.yaml
}
@test 'invalid "events_discarded" field type (not an integer) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-ed-not-int.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-ed-not-int.yaml
}
@test 'invalid "events_discarded" field type (signed) in packet context type makes barectf fail' {
- barectf_assert_file_exists pct-ed-wrong-signed.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pct-ed-wrong-signed.yaml
}
@test 'wrong "event-header-type" property type in stream object makes barectf fail' {
- barectf_assert_file_exists eht-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail eht-invalid-type.yaml
}
@test 'invalid "event-header-type" property field type (not a structure) in stream object makes barectf fail' {
- barectf_assert_file_exists eht-not-struct.yaml
- barectf_config_check_fail
+ barectf_config_check_fail eht-not-struct.yaml
}
@test 'invalid "timestamp" field type (not an integer) in event header type makes barectf fail' {
- barectf_assert_file_exists eht-timestamp-not-int.yaml
- barectf_config_check_fail
+ barectf_config_check_fail eht-timestamp-not-int.yaml
}
@test 'invalid "timestamp" field type (signed) in event header type makes barectf fail' {
- barectf_assert_file_exists eht-timestamp-wrong-signed.yaml
- barectf_config_check_fail
+ barectf_config_check_fail eht-timestamp-wrong-signed.yaml
}
@test 'invalid "timestamp" field type (not mapped to a clock) in event header type makes barectf fail' {
- barectf_assert_file_exists eht-timestamp-wrong-pm.yaml
- barectf_config_check_fail
+ barectf_config_check_fail eht-timestamp-wrong-pm.yaml
}
@test 'invalid "id" field type (not an integer) in event header type makes barectf fail' {
- barectf_assert_file_exists eht-id-not-int.yaml
- barectf_config_check_fail
+ barectf_config_check_fail eht-id-not-int.yaml
}
@test 'invalid "id" field type (signed) in event header type makes barectf fail' {
- barectf_assert_file_exists eht-id-wrong-signed.yaml
- barectf_config_check_fail
+ barectf_config_check_fail eht-id-wrong-signed.yaml
}
@test 'no event header type with multiple events in stream object makes barectf fail' {
- barectf_assert_file_exists eht-id-no-multiple-events.yaml
- barectf_config_check_fail
+ barectf_config_check_fail eht-id-no-multiple-events.yaml
}
@test '"id" field type size too small for the number of stream events in event header type makes barectf fail' {
- barectf_assert_file_exists eht-id-too-small.yaml
- barectf_config_check_fail
+ barectf_config_check_fail eht-id-too-small.yaml
}
@test 'wrong "event-context-type" property type in stream object makes barectf fail' {
- barectf_assert_file_exists ect-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ect-invalid-type.yaml
}
@test 'invalid "event-context-type" property field type (not a structure) in stream object makes barectf fail' {
- barectf_assert_file_exists ect-not-struct.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ect-not-struct.yaml
}
@test 'no "events" property in stream object makes barectf fail' {
- barectf_assert_file_exists events-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail events-no.yaml
}
@test 'wrong "events" property type in stream object makes barectf fail' {
- barectf_assert_file_exists events-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail events-invalid-type.yaml
}
@test 'empty "events" property in stream object makes barectf fail' {
- barectf_assert_file_exists events-empty.yaml
- barectf_config_check_fail
+ barectf_config_check_fail events-empty.yaml
}
@test 'invalid "events" key (invalid C identifier) in metadata object makes barectf fail' {
- barectf_assert_file_exists events-key-invalid-identifier.yaml
- barectf_config_check_fail
+ barectf_config_check_fail events-key-invalid-identifier.yaml
}
@test 'wrong "$default" property type in stream object makes barectf fail' {
- barectf_assert_file_exists default-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail default-invalid-type.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'unknown property in trace object makes barectf fail' {
- barectf_assert_file_exists unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail unknown-prop.yaml
}
@test 'wrong "byte-order" property type in trace object makes barectf fail' {
- barectf_assert_file_exists bo-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail bo-invalid-type.yaml
}
@test 'no "byte-order" property in trace object makes barectf fail' {
- barectf_assert_file_exists bo-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail bo-no.yaml
}
@test 'invalid "byte-order" property in trace object makes barectf fail' {
- barectf_assert_file_exists bo-invalid.yaml
- barectf_config_check_fail
+ barectf_config_check_fail bo-invalid.yaml
}
@test 'invalid "packet-header-type" property field type (not a structure) in trace object makes barectf fail' {
- barectf_assert_file_exists ph-not-struct.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-not-struct.yaml
}
@test 'wrong "uuid" property type in trace object makes barectf fail' {
- barectf_assert_file_exists uuid-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail uuid-invalid-type.yaml
}
@test 'invalid "uuid" property (invalid UUID format) in trace object makes barectf fail' {
- barectf_assert_file_exists uuid-invalid-uuid.yaml
- barectf_config_check_fail
+ barectf_config_check_fail uuid-invalid-uuid.yaml
}
@test 'invalid "magic" field type (not an integer) in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-magic-not-int.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-magic-not-int.yaml
}
@test 'invalid "magic" field type (wrong integer size) in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-magic-wrong-size.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-magic-wrong-size.yaml
}
@test 'invalid "magic" field type (signed) in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-magic-wrong-signed.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-magic-wrong-signed.yaml
}
@test 'invalid "stream_id" field type (not an integer) in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-streamid-not-int.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-streamid-not-int.yaml
}
@test 'invalid "stream_id" field type (signed) in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-streamid-wrong-signed.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-streamid-wrong-signed.yaml
}
@test '"stream_id" field type size too small for the number of trace streams in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-streamid-too-small.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-streamid-too-small.yaml
}
@test 'invalid "uuid" field type (not an array) in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-uuid-not-array.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-uuid-not-array.yaml
}
@test 'invalid "uuid" field type (wrong array length) in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-uuid-wrong-length.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-uuid-wrong-length.yaml
}
@test 'invalid "uuid" field type (element type is not an integer) in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-uuid-et-not-int.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-uuid-et-not-int.yaml
}
@test 'invalid "uuid" field type (wrong element type size) in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-uuid-et-wrong-size.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-uuid-et-wrong-size.yaml
}
@test 'invalid "uuid" field type (element type is signed) in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-uuid-et-wrong-signed.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-uuid-et-wrong-signed.yaml
}
@test 'invalid "uuid" field type (wrong element type alignment) in packet header type makes barectf fail' {
- barectf_assert_file_exists ph-uuid-et-wrong-align.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ph-uuid-et-wrong-align.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'unknown property in enum type object makes barectf fail' {
- barectf_assert_file_exists unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail unknown-prop.yaml
}
@test 'no "value-type" property in enum type object makes barectf fail' {
- barectf_assert_file_exists vt-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail vt-no.yaml
}
@test 'wrong "value-type" property type in enum type object makes barectf fail' {
- barectf_assert_file_exists vt-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail vt-invalid-type.yaml
}
@test 'no "members" property in enum type object makes barectf fail' {
- barectf_assert_file_exists members-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail members-no.yaml
}
@test 'wrong "members" property type in enum type object makes barectf fail' {
- barectf_assert_file_exists members-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail members-invalid-type.yaml
}
@test 'empty "members" property in enum type object makes barectf fail' {
- barectf_assert_file_exists members-empty.yaml
- barectf_config_check_fail
+ barectf_config_check_fail members-empty.yaml
}
@test 'wrong "members" property element type in enum type object makes barectf fail' {
- barectf_assert_file_exists members-el-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail members-el-invalid-type.yaml
}
@test 'unknown property in enum type member object makes barectf fail' {
- barectf_assert_file_exists members-el-member-unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail members-el-member-unknown-prop.yaml
}
@test 'wrong "label" property type in enum type member object makes barectf fail' {
- barectf_assert_file_exists members-el-member-label-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail members-el-member-label-invalid-type.yaml
}
@test 'wrong "value" property type in enum type member object makes barectf fail' {
- barectf_assert_file_exists members-el-member-value-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail members-el-member-value-invalid-type.yaml
}
@test '"value" property outside the unsigned value type range in enum type member object makes barectf fail' {
- barectf_assert_file_exists members-el-member-value-outside-range-unsigned.yaml
- barectf_config_check_fail
+ barectf_config_check_fail members-el-member-value-outside-range-unsigned.yaml
}
@test '"value" property outside the signed value type range in enum type member object makes barectf fail' {
- barectf_assert_file_exists members-el-member-value-outside-range-signed.yaml
- barectf_config_check_fail
+ barectf_config_check_fail members-el-member-value-outside-range-signed.yaml
}
@test 'overlapping members in enum type object makes barectf fail' {
- barectf_assert_file_exists members-overlap.yaml
- barectf_config_check_fail
+ barectf_config_check_fail members-overlap.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'unknown property in float type object makes barectf fail' {
- barectf_assert_file_exists unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail unknown-prop.yaml
}
@test 'no "size" property in float type object makes barectf fail' {
- barectf_assert_file_exists size-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail size-no.yaml
}
@test 'wrong "size" property type in float type object makes barectf fail' {
- barectf_assert_file_exists size-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail size-invalid-type.yaml
}
@test 'unknown property in float type object "size" property makes barectf fail' {
- barectf_assert_file_exists size-unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail size-unknown-prop.yaml
}
@test 'no "exp" property in float type object "size" property makes barectf fail' {
- barectf_assert_file_exists size-exp-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail size-exp-no.yaml
}
@test 'no "mant" property in float type object "size" property makes barectf fail' {
- barectf_assert_file_exists size-mant-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail size-mant-no.yaml
}
@test 'sum of "mant" and "exp" properties of float type size object not a multiple of 32 property makes barectf fail' {
- barectf_assert_file_exists size-exp-mant-wrong-sum.yaml
- barectf_config_check_fail
+ barectf_config_check_fail size-exp-mant-wrong-sum.yaml
}
@test 'wrong "align" property type in float type object makes barectf fail' {
- barectf_assert_file_exists align-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail align-invalid-type.yaml
}
@test 'invalid "align" property (0) in float type object makes barectf fail' {
- barectf_assert_file_exists align-0.yaml
- barectf_config_check_fail
+ barectf_config_check_fail align-0.yaml
}
@test 'invalid "align" property (3) in float type object makes barectf fail' {
- barectf_assert_file_exists align-3.yaml
- barectf_config_check_fail
+ barectf_config_check_fail align-3.yaml
}
@test 'wrong "byte-order" property type in float type object makes barectf fail' {
- barectf_assert_file_exists bo-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail bo-invalid-type.yaml
}
@test 'invalid "byte-order" property in float type object makes barectf fail' {
- barectf_assert_file_exists bo-invalid.yaml
- barectf_config_check_fail
+ barectf_config_check_fail bo-invalid.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'unknown property in int type object makes barectf fail' {
- barectf_assert_file_exists unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail unknown-prop.yaml
}
@test 'no "size" property in int type object makes barectf fail' {
- barectf_assert_file_exists size-no.yaml
- barectf_config_check_fail
+ barectf_config_check_fail size-no.yaml
}
@test 'wrong "size" property type in int type object makes barectf fail' {
- barectf_assert_file_exists size-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail size-invalid-type.yaml
}
@test 'invalid "size" property (0) in int type object makes barectf fail' {
- barectf_assert_file_exists size-0.yaml
- barectf_config_check_fail
+ barectf_config_check_fail size-0.yaml
}
@test 'invalid "size" property (65) in int type object makes barectf fail' {
- barectf_assert_file_exists size-65.yaml
- barectf_config_check_fail
+ barectf_config_check_fail size-65.yaml
}
@test 'wrong "signed" property type in int type object makes barectf fail' {
- barectf_assert_file_exists signed-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail signed-invalid-type.yaml
}
@test 'wrong "align" property type in int type object makes barectf fail' {
- barectf_assert_file_exists align-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail align-invalid-type.yaml
}
@test 'invalid "align" property (0) in int type object makes barectf fail' {
- barectf_assert_file_exists align-0.yaml
- barectf_config_check_fail
+ barectf_config_check_fail align-0.yaml
}
@test 'invalid "align" property (3) in int type object makes barectf fail' {
- barectf_assert_file_exists align-3.yaml
- barectf_config_check_fail
+ barectf_config_check_fail align-3.yaml
}
@test 'wrong "base" property type in int type object makes barectf fail' {
- barectf_assert_file_exists base-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail base-invalid-type.yaml
}
@test 'invalid "base" property in int type object makes barectf fail' {
- barectf_assert_file_exists base-invalid.yaml
- barectf_config_check_fail
+ barectf_config_check_fail base-invalid.yaml
}
@test 'wrong "byte-order" property type in int type object makes barectf fail' {
- barectf_assert_file_exists bo-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail bo-invalid-type.yaml
}
@test 'invalid "byte-order" property in int type object makes barectf fail' {
- barectf_assert_file_exists bo-invalid.yaml
- barectf_config_check_fail
+ barectf_config_check_fail bo-invalid.yaml
}
@test 'wrong "property-mappings" property type in int type object makes barectf fail' {
- barectf_assert_file_exists pm-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pm-invalid-type.yaml
}
@test 'invalid "property-mappings" property in int type object makes barectf fail' {
- barectf_assert_file_exists pm-unknown-clock.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pm-unknown-clock.yaml
}
@test 'invalid "property-mappings" property (invalid "type" property) in int type object makes barectf fail' {
- barectf_assert_file_exists pm-type-invalid.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pm-type-invalid.yaml
}
@test 'invalid "property-mappings" property (invalid "property" property) in int type object makes barectf fail' {
- barectf_assert_file_exists pm-property-invalid.yaml
- barectf_config_check_fail
+ barectf_config_check_fail pm-property-invalid.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'unknown property in string type object makes barectf fail' {
- barectf_assert_file_exists unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail unknown-prop.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'unknown property in struct type object makes barectf fail' {
- barectf_assert_file_exists unknown-prop.yaml
- barectf_config_check_fail
+ barectf_config_check_fail unknown-prop.yaml
}
@test 'wrong "fields" property type in struct type object makes barectf fail' {
- barectf_assert_file_exists fields-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail fields-invalid-type.yaml
}
@test 'invalid field in "fields" property (invalid C identifier) in struct type object makes barectf fail' {
- barectf_assert_file_exists fields-field-invalid-identifier.yaml
- barectf_config_check_fail
+ barectf_config_check_fail fields-field-invalid-identifier.yaml
}
@test 'wrong "min-align" property type in struct type object makes barectf fail' {
- barectf_assert_file_exists ma-invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ma-invalid-type.yaml
}
@test 'invalid "min-align" property (0) in struct type object makes barectf fail' {
- barectf_assert_file_exists ma-0.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ma-0.yaml
}
@test 'invalid "min-align" property (3) in struct type object makes barectf fail' {
- barectf_assert_file_exists ma-3.yaml
- barectf_config_check_fail
+ barectf_config_check_fail ma-3.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'type inheriting an unknown type alias makes barectf fail' {
- barectf_assert_file_exists inherit-unknown.yaml
- barectf_config_check_fail
+ barectf_config_check_fail inherit-unknown.yaml
}
@test 'type inheriting a type alias defined after makes barectf fail' {
- barectf_assert_file_exists inherit-forward.yaml
- barectf_config_check_fail
+ barectf_config_check_fail inherit-forward.yaml
}
@test 'wrong type property type makes barectf fail' {
- barectf_assert_file_exists invalid-type.yaml
- barectf_config_check_fail
+ barectf_config_check_fail invalid-type.yaml
}
@test 'no "class" property in type object makes barectf fail' {
- barectf_assert_file_exists no-class.yaml
- barectf_config_check_fail
+ barectf_config_check_fail no-class.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'invalid YAML input makes barectf fail' {
- barectf_assert_file_exists invalid.yaml
- barectf_config_check_fail
+ barectf_config_check_fail invalid.yaml
}
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-load ../../../common
load ../../common
@test 'config file using all features makes barectf pass' {
- barectf_assert_file_exists config.yaml
- [ $status -eq 0 ]
+ barectf_config_check_success config.yaml
[ -f metadata ]
[ -f bctf.c ]
[ -f bctf.h ]
fi
for d in "${test_dirs[@]}"; do
- pushd "$d"
+ pushd "$d" >/dev/null
$bats_bin "${@}" .
if [ $? -ne 0 ]; then
# latch error, but continue other tests
rc=1
fi
- popd
+ popd >/dev/null
done
exit $rc