Skip to content

Commit

Permalink
Ensure the tst.varint test can run outside the build tree
Browse files Browse the repository at this point in the history
The tst.varint.c test was depending on two source tree files.  Those
files are no longer available when you install DTrace packages.  The
test has been turned into a script that executes a test/utils program
that is compiled at build time.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
  • Loading branch information
kvanhees committed Jun 23, 2021
1 parent b61627e commit 53b33a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 9 additions & 0 deletions test/internals/tst.varint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
#
# Oracle Linux DTrace.
# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.
#

exec test/utils/tst.varint
4 changes: 2 additions & 2 deletions test/utils/Build
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Oracle Linux DTrace.
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.

TEST_UTILS = baddof badioctl showUSDT print-stack-layout
TEST_UTILS = baddof badioctl showUSDT print-stack-layout tst.varint

define test-util-template
CMDS += $(1)
Expand Down
6 changes: 2 additions & 4 deletions test/internals/tst.varint.c → test/utils/tst.varint.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* @@link: -Ilibdtrace */

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -9,7 +7,7 @@ void
check(uint64_t val, int exp)
{
char s[VARINT_MAX_BYTES];
char *p;
const char *p;
int rc, len;
uint64_t dval;

Expand All @@ -28,7 +26,7 @@ check(uint64_t val, int exp)
printf("Skip wrong for %lu: %d vs %d\n", val, 0, exp);
exit(1);
} else if ((p - s) != exp) {
printf("Skip wrong for %lu: %d vs %d\n", val, p - s, exp);
printf("Skip wrong for %lu: %ld vs %d\n", val, p - s, exp);
exit(1);
}
dval = dt_vint2int(s);
Expand Down

0 comments on commit 53b33a8

Please sign in to comment.