commit a1d702989d3074af1b28253e667084396e8fe741
parent 7fb5cbb5e51f4d5db2129f9f3b139a6dd9409a60
Author: Kyle Milz <kyle@0x30.net>
Date: Thu, 11 Aug 2016 18:20:08 -0600
t: add new version for mismatched tu checking
Diffstat:
3 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/src/runtime.c b/src/runtime.c
@@ -45,7 +45,7 @@ citrun_node_add(uint8_t node_major, uint8_t node_minor, struct citrun_node *n)
/* Instrumented code and the runtime it links to are tightly bound. */
if (node_major != citrun_major || node_minor != citrun_minor) {
- warnx("libcitrun-%i.%i: Node has mismatched version '%i.%i'",
+ warnx("libcitrun %i.%i: node with version %i.%i skipped",
citrun_major, citrun_minor,
node_major, node_minor);
return;
diff --git a/t/rt_ver.t b/t/rt_ver.t
@@ -0,0 +1,27 @@
+#!/bin/sh
+echo 1..2
+
+. test/utils.sh
+setup
+
+cat <<EOF > main.c
+#include <stddef.h>
+
+int
+main(int argc, char *argv[])
+{
+ citrun_node_add(0, 255, NULL);
+}
+EOF
+
+/usr/bin/cc -c main.c
+/usr/bin/cc -o main main.o -pthread $CITRUN_TOOLS/libcitrun.a
+
+export CITRUN_SOCKET=
+main 2> out
+
+cat <<EOF > good
+main: libcitrun 0.0: node with version 0.255 skipped
+EOF
+
+diff -u good out && echo ok 2
diff --git a/test/utils.sh b/test/utils.sh
@@ -4,6 +4,7 @@ function setup
trap "rm -rf $tmpdir" EXIT
echo "ok 1 - tmp dir created"
- export PATH="`pwd`/src:${PATH}"
+ export CITRUN_TOOLS="`pwd`/src";
+ export PATH="${CITRUN_TOOLS}:${PATH}"
cd $tmpdir
}