Skip to content

Commit

Permalink
uapi headers: include <sys/dtrace_types> as needed
Browse files Browse the repository at this point in the history
This is needed for _LITTLE_ENDIAN and _BIG_ENDIAN.

Add a new internals test to identify this class of failure: add a
tag 'uninstalled' which is disabled in the installed tree to prevent it
from being executed as part of the installed testsuite (since it is not
particularly useful outside the installed set, and making it work in
both places would be complicated and annoying).

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
nickalcock authored and kvanhees committed Oct 25, 2022
1 parent 0811eb4 commit b81f4b1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/dtrace/actions_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#ifndef _DTRACE_ACTIONS_DEFINES_H
#define _DTRACE_ACTIONS_DEFINES_H

#include <sys/dtrace_types.h>
#include <dtrace/universal.h>

/*
Expand Down
3 changes: 2 additions & 1 deletion include/dtrace/dof_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
*/

/*
Expand All @@ -13,6 +13,7 @@
#ifndef _DTRACE_DOF_DEFINES_H
#define _DTRACE_DOF_DEFINES_H

#include <sys/dtrace_types.h>
#include <dtrace/universal.h>

/*
Expand Down
1 change: 1 addition & 0 deletions test/Build
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ install-test::
cp -a $$name "$(INSTTESTDIR)/test/$$(basename $$name)"; \
chown -R root:root "$(INSTTESTDIR)/test/$$(basename $$name)" 2>/dev/null || true; \
done
echo '!uninstalled' >> $(INSTTESTDIR)/test/tags.default

include test/triggers/Build
include test/utils/Build
30 changes: 30 additions & 0 deletions test/internals/headers/tst.header-endianness.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
#
# Oracle Linux DTrace.
# Copyright (c) 2022, 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.
#
# @@tags: uninstalled

set -e

dtrace=$1
CC=/usr/bin/gcc
OLDDIRNAME=`pwd`
CFLAGS="-I${PWD}/include"

DIRNAME="$tmpdir/usdt-entryreturn.$$.$RANDOM"
mkdir -p $DIRNAME
cd $DIRNAME

for header in ${OLDDIRNAME}/include/dtrace/*.h; do
grep -q _ENDIAN $header || continue
cat > test.c <<EOF
#include "$header"
#if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
#error $header: needs to include <sys/dtrace_types.h>
#endif
EOF
$CC -c $CFLAGS -o /dev/null test.c
done

0 comments on commit b81f4b1

Please sign in to comment.