ctf-testsuite
=============
-The Common Trace Format (CTF) testsuite is intended to validate the conformance of CTF readers.
+The Common Trace Format (CTF) testsuite is intended to validate the
+conformance of CTF readers.
To run the testsuite simply export CTF_READER_BIN="$YOUR_CTF_READER" and
-use the run.sh script found in the tests/1.8/ or tests/1.9/ folder,
-depending on the CTF specification version you want to check.
+use the run.sh script found in the tests/x.y/ folder, x.y being the CTF
+specification version you want to check.
+++ /dev/null
-/* CTF 1.8 */
+++ /dev/null
-/* CTF 1.8
- *
- * Architecture with 32-bit pointers, 32-bit integers, 32-bit longs.
- */
-
-typealias integer { size = 1; align = 1; signed = false; } := uint1_t;
-typealias integer { size = 8; align = 8; signed = false; } := uint8_t;
-typealias integer { size = 63; align = 1; signed = false; } := timestamp_t;
-
-typealias integer { size = 32; align = 32; signed = false; base = 10; } := uint32_t;
-typealias integer { size = 32; align = 32; signed = false; } := void *;
-
-
-trace {
- major = 0;
- minor = 1;
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- uint8_t uuid[16];
- uint32_t stream_id;
- };
-};
-
-stream {
- event.header := struct {
- uint1_t id;
- timestamp_t timestamp;
- };
- event.context := struct {
- uint32_t thread_id;
- uint32_t event_count;
- };
-};
-
-event {
- name = func_enter;
- id = 0;
- fields := struct {
- void *func_called;
- void *called_from;
- };
-};
-
-event {
- name = func_exit;
- id = 1;
-};
+++ /dev/null
-/* CTF 1.8 */
-typealias integer { size = 8; align = 8; signed = false; } := uint8_t;
-typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
-
-trace {
- /* Integer out of range */
- major = 23452397856348975623897562893746589237465289374658923764598237645897234658723648579236;
- minor = 1;
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- uint8_t uuid[16];
- };
-};
-
-stream {
- packet.context := struct {
- uint32_t content_size;
- uint32_t packet_size;
- };
-};
-
-event {
- name = string;
- fields := struct { string str; };
-};
+++ /dev/null
-#!/bin/sh
-
-. ../../../utils/run.sh
+++ /dev/null
-Á\1füÁ*d
\ No newline at end of file
+++ /dev/null
-/* CTF 1.8 */
-typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t;
-typealias integer { size = 32; align = 32; signed = false; base = hex; } := uint32_t;
-
-trace {
- major = 0;
- minor = 1;
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- uint8_t uuid[16];
- };
-};
-
-event {
- name = string;
- fields := struct { string str; };
-};
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com>
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License, version 2 only, as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-CURDIR=$(dirname $0)
-UTILS_DIR=$CURDIR/../../../utils/
-
-source $UTILS_DIR/tap/tap.sh
-
-NUM_TESTS=1
-
-plan_tests $NUM_TESTS
-
-$CTF_READER_BIN $CTF_READER_OPTS $1 >/dev/null 2>&1
-
-result=$?
-
-is $result 1 $1
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: size = 0 */
-typealias integer { size = 0; align = 8; signed = false; } := uint0_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: Alignment values must be power of two. */
-typealias integer { size = 8; align = 17; signed = false; } := uint0_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: invalid byte ordering. */
-typealias integer { size = 8; align = 8; signed = false; byte_order = iroquois; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: invalid signed. */
-typealias integer { size = 8; align = 8; signed = svp; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: negative size. */
-typealias integer { size = -8; align = 8; signed = false; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: negative align. */
-typealias integer { size = 8; align = -8; signed = false; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-
-/* FAIL: size as string. */
-typealias integer { size = "8"; align = 8; signed = false; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: align as string. */
-typealias integer { size = 8; align = "8"; signed = false; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-
-/* FAIL: signed as string. */
-typealias integer { size = 8; align = 8; signed = "false"; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: name is a keyword. */
-typealias integer { size = 8; align = 8; signed = "false"; } := trace;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: missing size. */
-typealias integer { align = 8; signed = "false"; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: invalid kind. */
-typealias entier { size = 8; align = 8; signed = false; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: base as a string. */
-typealias integer { size = 8; align = 8; signed = false; base = "decimal"; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: invalid base. */
-typealias integer { size = 8; align = 8; signed = false; base = orthogonal; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: invalid encoding. */
-typealias integer { size = 8; align = 8; signed = false; encoding = true; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: encoding as a string. */
-typealias integer { size = 8; align = 8; signed = false; encoding = "ascii"; } := uint8_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-typealias integer { size = 8; align = 8; signed = false; } := uint8_t;
-
-/* FAIL: out of range */
-enum dummy : uint8_t {
- x = 1024
-};
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
-
-
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: out of range */
-enum dummy : uint32_t {
- x = -1
-};
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
-
-
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: implicite type int, but undefined. */
-enum dummy {
- x = 1024
-};
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
-
-
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: type int, but undefined. */
-struct dummy {
- int xxx;
-};
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
-
-
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: duplicate name */
-struct dummy {
- uint32_t xxx;
- uint32_t xxx;
-};
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
-
-
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: duplicate name. */
-struct a {
- uint32_t xxx;
-};
-
-struct a {
- uint32_t xxx;
-};
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
-
-
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: duplicate name. */
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
-
-
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: keyword as a field. */
-struct a {
- uint32_t trace;
-};
-
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
-
-
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: keyword as a field. */
-struct a {
- uint32_t x;
-} align(-1);
-
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
-
-
+++ /dev/null
-/* CTF 1.8 */
-
-typealias integer { size = 32; align = 8; signed = false; } := uint32_t;
-
-/* FAIL: negative array. */
-typedef uint32_t name[-1];
-
-trace {
- major = 2;
- minor = 1;
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- };
-};
-
-
+++ /dev/null
-/* CTF 1.8 */
-typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t;
-typealias integer { size = 32; align = 32; signed = false; base = hex; } := uint32_t;
-
-trace {
- major = 0;
- minor = 1;
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
-};
-
-event {
- name = string;
- fields := struct { string str; };
-};
+++ /dev/null
-Á\1füÁ*d"Ðlî\11à\8c\bË\a׳¥d
\ No newline at end of file
+++ /dev/null
-/* CTF 1.8 */
-typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t;
-typealias integer { size = 32; align = 32; signed = false; base = hex; } := uint32_t;
-
-trace {
- major = 0;
- minor = 1;
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- uint8_t uuid[16];
- };
-};
-
-event {
- name = string;
- fields := struct { string str; };
-};
+++ /dev/null
-/* CTF 1.8 */
-typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t;
-typealias integer { size = 32; align = 32; signed = false; base = hex; } := uint32_t;
-
-trace {
- major = 0;
- minor = 1;
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- uint8_t uuid[16];
- };
-};
-
-env {
- dummy = "blah";
-};
-
-stream {
- packet.context := struct {
- uint32_t content_size;
- uint32_t packet_size;
- };
-};
-
-event {
- name = string;
- fields := struct { string str; };
-};
+++ /dev/null
-/* CTF 1.8 */
+++ /dev/null
-#!/bin/sh
-
-. ../../../utils/run.sh
+++ /dev/null
-/* CTF 1.8 */
-typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t;
-typealias integer { size = 32; align = 32; signed = false; base = hex; } := uint32_t;
-
-trace {
- major = 0;
- minor = 1;
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- uint8_t uuid[16];
- };
-};
-
-event {
- name = string;
- fields := struct { string str; };
-};
+++ /dev/null
-/* CTF 1.8 */
-
-trace {
- test = "abc" "def";
-};
+++ /dev/null
-/* CTF 1.8 */
-typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t;
-typealias integer { size = 32; align = 32; signed = false; base = hex; } := uint32_t;
-
-trace {
- major = 0;
- minor = 1;
- test2 = "?\x20\040\123\0?";
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- uint8_t uuid[16];
- };
-};
-
-/* use babeltrace -f trace:hostname to print. */
-
-/*
- * Expected:
-
-abc " hex: A, #, #, #1,
-oct: A, #, #, #1,
-
- */
-
-env {
- hostname = "\nabc \" hex: \x41, \x23, \x023, \x0231,\noct: \101, \043, \43, \0431, \0NOT SEEN";
-};
-
-stream {
- packet.context := struct {
- uint32_t content_size;
- uint32_t packet_size;
- };
-};
-
-event {
- name = string;
- fields := struct { string str; };
-};
+++ /dev/null
-/* CTF 1.8 */
-typealias integer { size = 8; align = 8; signed = false; } := uint8_t;
-typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
-
-trace {
- major = 0;
- minor = 1;
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- uint8_t uuid[16];
- };
-};
-
-stream {
- packet.context := struct {
- uint32_t content_size;
- uint32_t packet_size;
- };
-};
-
-event {
- name = string;
- fields := struct { string str; };
-};
+++ /dev/null
-/* CTF 1.8 */
-typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t;
-typealias integer { size = 32; align = 32; signed = false; base = hex; } := uint32_t;
-
-trace {
- major = 0;
- minor = 1;
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- uint8_t uuid[16];
- };
-};
-
-stream {
- packet.context := struct {
- uint32_t content_size;
- uint32_t packet_size;
- };
-};
-
-event {
- name = string;
- fields := struct { string str; };
-};
+++ /dev/null
-/* CTF 1.8 */
-typealias integer { size = 8; align = 8; signed = false; } := uint8_t;
-typealias integer { size = 32; align = 32; signed = false; } := uint32_t;
-
-trace {
- major = 0;
- minor = 1;
- test = 0xABC234; /* hexadecimal */
- test1 = 06534; /* octal */
- test2 = 1234; /* decimal */
- test3 = +1234; /* decimal with + unary op */
- test4 = -1234; /* decimal (negated) */
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- uint8_t uuid[16];
- };
-};
-
-stream {
- packet.context := struct {
- uint32_t content_size;
- uint32_t packet_size;
- };
-};
-
-event {
- name = string;
- fields := struct { string str; };
-};
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com>
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License, version 2 only, as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-CURDIR=$(dirname $0)
-UTILS_DIR=$CURDIR/../../../utils/
-
-source $UTILS_DIR/tap/tap.sh
-
-NUM_TESTS=1
-
-plan_tests $NUM_TESTS
-
-$CTF_READER_BIN $CTF_READER_OPTS $1 >/dev/null 2>&1
-
-result=$?
-
-is $result 0 $1
+++ /dev/null
-/* CTF 1.8 */
-typealias integer { size = 8; align = 8; signed = false; aa = bb; } := uint8_t;
-typealias integer { size = 32; align = 32; signed = false; zz = aa; } := uint32_t;
-
-trace {
- major = 0;
- minor = 1;
- uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564";
- byte_order = le;
- packet.header := struct {
- uint32_t magic;
- uint8_t uuid[16];
- };
- blah = "aaa";
-};
-
-stream {
- packet.context := struct {
- uint32_t content_size;
- uint32_t packet_size;
- };
- askdjfhaskdjfh = 1;
-};
-
-event {
- name = string;
- fields := struct { string str; };
- asdjfhah := struct { uint8_t ffff; };
-};
+++ /dev/null
-#!/bin/sh
-
-echo "Running expected pass tests"
-cd pass
-./run.sh
-cd ..
-
-echo "Running expected failure tests"
-cd fail
-./run.sh
-cd ..