summaryrefslogtreecommitdiff
path: root/libl4
diff options
context:
space:
mode:
authormarcus <marcus>2005-02-18 03:58:08 +0000
committermarcus <marcus>2005-02-18 03:58:08 +0000
commitaf8ae9f379ab26c40a7efe3e3efdc86f7955d823 (patch)
treef92adb60c7f5509f28364a7cee2811d6721455bd /libl4
parentac8427463493edc96a390e7089598f93c303426f (diff)
2005-02-18 Marcus Brinkmann <marcus@gnu.org>
Everywhere: Add support for disabling/enabling testing individual interfaces, including the internal interface. * README: New file. * tests/t-l4-kip.c (test_utcb_info): New function. (test_boot_info): Likewise. (test_clock_info): Likewise. (test_kip_area_info): Likewise. (test_thread_info): Likewise. (test_syscalls): Likewise. (test): Call test_utcb_info, test_clock_info, test_kip_area_info, test_thread_info, test_boot_info and test_syscalls. (test_processor_info): Test the RAW member of an L4_ProcDesc_t. (test_magic): Also check L4_GetKernelInterface.
Diffstat (limited to 'libl4')
-rw-r--r--libl4/ChangeLog17
-rw-r--r--libl4/tests/README128
-rw-r--r--libl4/tests/environment.h60
-rw-r--r--libl4/tests/t-l4-kip.c623
-rw-r--r--libl4/tests/t-l4-message.c32
5 files changed, 669 insertions, 191 deletions
diff --git a/libl4/ChangeLog b/libl4/ChangeLog
index 45e6df4..f180896 100644
--- a/libl4/ChangeLog
+++ b/libl4/ChangeLog
@@ -1,3 +1,20 @@
+2005-02-18 Marcus Brinkmann <marcus@gnu.org>
+
+ Everywhere: Add support for disabling/enabling testing individual
+ interfaces, including the internal interface.
+ * README: New file.
+
+ * tests/t-l4-kip.c (test_utcb_info): New function.
+ (test_boot_info): Likewise.
+ (test_clock_info): Likewise.
+ (test_kip_area_info): Likewise.
+ (test_thread_info): Likewise.
+ (test_syscalls): Likewise.
+ (test): Call test_utcb_info, test_clock_info, test_kip_area_info,
+ test_thread_info, test_boot_info and test_syscalls.
+ (test_processor_info): Test the RAW member of an L4_ProcDesc_t.
+ (test_magic): Also check L4_GetKernelInterface.
+
2005-02-15 Marcus Brinkmann <marcus@gnu.org>
* ia32/l4/bits/vregs.h (_L4_utcb) [_L4_TEST_ENVIRONMENT]: Use
diff --git a/libl4/tests/README b/libl4/tests/README
new file mode 100644
index 0000000..96ece6a
--- /dev/null
+++ b/libl4/tests/README
@@ -0,0 +1,128 @@
+Test suite for GNU libl4
+========================
+
+This test suite for GNU libl4 contains extensive checks for all
+aspects of the interfaces provided by libl4. The goal is to verify
+all public interfaces and some internal interfaces, as well as
+performing consistency checks. It should also contain tests for bugs
+that have been found and fixed, to make sure that they never sneak
+back again.
+
+
+Status
+------
+
+* Chapter 1: Basic Kernel Interfaces
+ l4/kip.h: Almost complete. Only testing the memory descriptors is missing.
+ Testing the processor descriptors and kernel features must be
+ improved though to not require the internal interface.
+ l4/message.h: Complete.
+
+All other interfaces are not tested.
+
+
+Limitations
+-----------
+
+* Only the C interface is tested. A test of the C++ interface is not
+ planned.
+
+* Side effects beyond the actual purpose of a function are hardly checked.
+
+* For completeness, see the "Status" section above.
+
+
+How does this work?
+-------------------
+
+The file "environment.h" contains a fake L4 environment, including a
+kernel interface page and a UTCB. It also overrides the functions in
+libl4 to access this environment (minimal support in libl4 is required
+for this). This makes all other functions in libl4 use the fake
+environment for operation.
+
+In addition to this fake environment, support routines are provided
+that makes it easier to write tests and allows to access the fake
+environment directly for better evaluation.
+
+The file "environment.h" is included in all test files before any
+libl4 header file to activate and make use of the fake environment.
+The test files then are written just as any other libl4 using
+programs, except that they may call additional support functions to
+evaluate the test results.
+
+
+How do I add new tests?
+-----------------------
+
+Just follow the existing examples. It is pretty simple. Features are
+added to the fake environment on an "as-needed" basis, so don't be shy
+to hack it.
+
+Please make sure that all three interfaces (intern, GNU, L4) are
+tested, but independently of each other.
+
+Here some hints:
+
+* Check all macro symbols if they have the correct value.
+
+* Check all inline functions (to make sure they actually compile).
+
+* Check all data types (to make sure they have the proper size and structure).
+
+* If a function allows a variable argument, loop over a sample set of
+ values for that argument. Test border cases as well as random
+ samples of common values.
+
+* If a function allows multiple variable arguments, loop over all
+ combinations of such samples. Note that the number of such
+ combinations can be very high, so keep the data sets small in this case.
+ Of course this makes only sense if you can compute the correct
+ result from the individual data sets. If this is not possible, and
+ you have to include the result into your data sets, then it is better
+ to only have one small data set for all variable arguments (ie treat
+ them as one logical unit).
+
+* If you add a new function to libl4, add tests for this new function, too!
+
+* If you modify a function in libl4, make sure that the existing tests
+ are modified to take this into account. If your modification does not
+ affect any existing test, then try to add a test that would fail
+ before your change and succeeds afterwards.
+
+* If you fix a bug, try to add a test that fails if the bug is present and
+ succeeds if it is not.
+
+
+Other libl4 implementations
+---------------------------
+
+Other implementations of the L4 API can not be tested with this test
+suite without modifications, as the fake environment needs to be
+tightly integrated with the implementation at three points:
+
+* The UTCB address used must be the one provided by "environment.h".
+
+* The kernel interface system call stub must return the address of the
+ KIP and the other values provided by "environment.h".
+
+* The system call links provided by "environment.h" must be used.
+
+If you implement these integration measures, you can try to add
+support for your libl4 in environment.h where _L4_TEST_EXTERNAL_LIBL4
+is checked and define the C preprocessor symbol _L4_TEST_EXTERNAL_LIBL4
+when compiling. Good luck. Let us know how it works, and send in
+patches for any remaining glitches.
+
+
+Copyright 2005 Free Software Foundation, Inc.
+Written by Marcus Brinkmann <marcus@gnu.org>
+
+This file is free software; as a special exception the author gives
+unlimited permission to copy and/or distribute it, with or without
+modifications, as long as this notice is preserved.
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
diff --git a/libl4/tests/environment.h b/libl4/tests/environment.h
index 8d174be..8a699ff 100644
--- a/libl4/tests/environment.h
+++ b/libl4/tests/environment.h
@@ -7,20 +7,21 @@
whole libl4 headers via pthread (which currently fails as pthread
doesn't include the header files). Ouch! */
extern char *getenv (const char *name);
+extern void exit (int status) __attribute__ ((__noreturn__));
/* A type that behaves like char * alias-wise, but has the width of
the system word size. */
#ifdef __i386__
-typedef unsigned int __attribute__((__mode__ (__SI__), __may_alias__))
- big_char_like;
+typedef unsigned int __attribute__((__mode__ (__SI__))) word_t;
+typedef word_t __attribute__((__may_alias__)) word_ma_t;
#else
#error not ported to this architecture
#endif
/* Our kernel interface page. */
#ifdef __i386__
-static const big_char_like environment_kip[] =
+static const word_ma_t environment_kip[] =
{
/* 0x0000 */ 0x4be6344c, 0x84050000, 0x00000000, 0x00000140,
/* 0x0010 */ 0x0014fab0, 0xf0129720, 0x00000000, 0x00000000,
@@ -61,39 +62,69 @@ static const big_char_like environment_kip[] =
contains the system call stubs. */
};
-static unsigned int environment_api_version = 0x84050000;
-static unsigned int environment_api_flags = 0x00000000;
-static unsigned int environment_kernel_id = 0x04020000;
+static word_t __attribute__((__unused__)) environment_api_version = 0x84050000;
+static word_t __attribute__((__unused__)) environment_api_flags = 0x00000000;
+static word_t __attribute__((__unused__)) environment_kernel_id = 0x04020000;
/* 64 MRs forwards, 16 UTCB words and 33 BRs backwards. */
-static big_char_like environment_utcb[64 + 16 + 33];
-static big_char_like *environment_utcb_address = &environment_utcb[33 + 16];
+static word_t environment_utcb[64 + 16 + 33];
+static word_t *environment_utcb_address = &environment_utcb[33 + 16];
#else
#error not ported to this architecture
#endif
+
+#ifdef _L4_TEST_EXTERNAL_LIBL4
+
+#warning Add support for your external libl4 here.
+
+/* Only check the official interface. */
+#undef _L4_INTERFACE_INTERN
+#undef _L4_INTERFACE_GNU
+#define _L4_INTERFACE_L4 1
+
+#else /* _L4_TEST_EXTERNAL_LIBL4 */
+
+/* This signals to libl4 that we are running in a fake test
+ environment. */
+#define _L4_TEST_ENVIRONMENT 1
+/* Our implementation of the kernel interface system call. */
#define _L4_TEST_KERNEL_INTERFACE_IMPL \
*api_version = environment_api_version; \
*api_flags = environment_api_flags; \
*kernel_id = environment_kernel_id; \
return (_L4_kip_t) environment_kip;
+/* Our implementation of the "get utcb address" function. */
#define _L4_TEST_UTCB_IMPL \
return (_L4_word_t *) environment_utcb_address;
-/* This signals to libl4 that we are running in a fake test
- environment. */
-#define _L4_TEST_ENVIRONMENT 1
-
-
/* Enable all interfaces. */
+#define _L4_INTERFACE_INTERN 1
#define _L4_INTERFACE_L4 1
#define _L4_INTERFACE_GNU 1
-
#include <l4/features.h>
+/* If you want to test if you wrote the tests for the various
+ interfaces independently of each other, enable one of these. */
+#if 0
+/* Only the official interface. */
+#undef _L4_INTERFACE_INTERN
+#undef _L4_INTERFACE_GNU
+#elsif 0
+/* Only the GNU interface. */
+#undef _L4_INTERFACE_INTERN
+#undef _L4_INTERFACE_L4
+#elsif 0
+/* Only the internal interface. */
+#undef _L4_INTERFACE_GNU
+#undef _L4_INTERFACE_L4
+#endif
+
+#endif /* _L4_TEST_EXTERNAL_LIBL4 */
+
#ifdef _L4_INTERFACE_GNU
@@ -170,7 +201,6 @@ static inline environment_init (int argc, char *argv[])
/* Support macros. */
#include <stdio.h>
-#include <stdlib.h>
#define check(prefix,msg,cond,...) \
do \
diff --git a/libl4/tests/t-l4-kip.c b/libl4/tests/t-l4-kip.c
index ff239e3..c8c3978 100644
--- a/libl4/tests/t-l4-kip.c
+++ b/libl4/tests/t-l4-kip.c
@@ -31,78 +31,89 @@
/* Test the various ways to get a pointer to the kernel interface
page, and the magic bytes at the beginning. */
-_L4_kip_t
+void *
test_magic ()
{
- /* This is our atom. We can't check it except by looking at the
- magic, and we set it in our faked environment anyway. */
- _L4_api_version_t api_version;
- _L4_api_flags_t api_flags;
- _L4_kernel_id_t kernel_id;
- _L4_kip_t kip = _L4_kernel_interface (&api_version, &api_flags, &kernel_id);
-
- /* Verify that our fake KIP is actually there. */
- check ("[intern]", "if fake KIP is installed",
-
- (kip->magic[0] == 'L' && kip->magic[1] == '4'
- && kip->magic[2] == (char) 0xe6 && kip->magic[3] == 'K'),
-
- "_L4_kernel_interface kip magic == %c%c%c%c != L4\xe6K\n",
- kip->magic[0], kip->magic[1], kip->magic[2], kip->magic[3]);
+ void *kip_ok = (void *) environment_kip;
+ word_t api_version_ok = environment_api_version;
+ word_t api_flags_ok = environment_api_flags;
+ word_t kernel_id_ok = environment_kernel_id;
+#ifdef _L4_INTERFACE_INTERN
+ {
+ /* This is our atom. We can't check it except by looking at the
+ magic, and we set it in our faked environment anyway. */
+ _L4_api_version_t api_version;
+ _L4_api_flags_t api_flags;
+ _L4_kernel_id_t kernel_id;
+ _L4_kip_t kip = _L4_kernel_interface (&api_version, &api_flags,
+ &kernel_id);
- /* Verify the other values returned by _L4_kernel_interface. This
- is basically an internal consistency check. */
- check ("[intern]", "if fake API version matches KIP",
- (api_version == kip->api_version.raw),
- "_L4_kernel_interface api_version == 0x%x != 0x%x\n",
- api_version, kip->api_version.raw);
- check ("[intern]", "if fake API flags matches KIP",
- (api_flags == kip->api_flags.raw),
- "_L4_kernel_interface api_flags == 0x%x != 0x%x\n",
- api_flags, kip->api_flags.raw);
- check ("[intern]", "if fake kernel ID flags matches KIP",
- (kernel_id == _L4_kernel_desc (kip)->id.raw),
- "_L4_kernel_interface kernel_id == 0x%x != 0x%x\n",
- kernel_id, _L4_kernel_desc (kip)->id.raw);
+ check ("[GNU]", "if l4_kip() returns the KIP",
+ (kip == kip_ok),
+ "kip == %p != %p\n", kip, kip_ok);
+
+ /* Verify that our fake KIP is actually there. */
+ check ("[intern]", "if fake KIP is installed",
+ (kip->magic[0] == 'L' && kip->magic[1] == '4'
+ && kip->magic[2] == (char) 0xe6 && kip->magic[3] == 'K'),
+ "_L4_kernel_interface kip magic == %c%c%c%c != L4\xe6K\n",
+ kip->magic[0], kip->magic[1], kip->magic[2], kip->magic[3]);
+
+ /* Verify the other values returned by _L4_kernel_interface. This
+ is basically an internal consistency check. */
+ check_nr ("[intern]", "if fake API version is returned",
+ api_version, api_version_ok);
+ check_nr ("[intern]", "if fake API version matches KIP",
+ api_version, kip->api_version.raw);
+ check_nr ("[intern]", "if fake API flags are returned",
+ api_flags, api_flags_ok);
+ check_nr ("[intern]", "if fake API flags matches KIP",
+ api_flags, kip->api_flags.raw);
+ check_nr ("[intern]", "if fake kernel ID is returned",
+ kernel_id, kernel_id_ok);
+ check_nr ("[intern]", "if fake kernel ID matches KIP",
+ kernel_id, _L4_kernel_desc (kip)->id.raw);
+ }
+#endif
#ifdef _L4_INTERFACE_GNU
{
/* Some other ways to get the same information. */
- l4_kip_t kip_gnu = l4_kip ();
+ l4_kip_t kip = l4_kip ();
check ("[GNU]", "if l4_kip() returns the KIP",
- (kip_gnu == kip),
- "kip_gnu == %p != %p\n", kip_gnu, kip);
+ (kip == kip_ok),
+ "kip == %p != %p\n", kip, kip_ok);
}
#endif
#ifdef _L4_INTERFACE_L4
{
- L4_Word_t api_version_l4;
- L4_Word_t api_flags_l4;
- L4_Word_t kernel_id_l4;
-
- void *kip_l4 = L4_KernelInterface (&api_version_l4, &api_flags_l4,
- &kernel_id_l4);
+ L4_Word_t api_version;
+ L4_Word_t api_flags;
+ L4_Word_t kernel_id;
+ void *kip = L4_KernelInterface (&api_version, &api_flags, &kernel_id);
check ("[L4]", "if L4_KernelInterface returns the KIP",
- (kip_l4 == kip),
- "kip_l4 == %p != %p\n", kip_l4, kip);
-
- check ("[L4]", "if L4 API version matches KIP",
- (api_version_l4 == api_version),
- "api_version_l4 == 0x%x != 0x%x\n", api_version_l4, api_version);
- check ("[L4]", "if L4 API flags matches KIP",
- (api_flags_l4 == api_flags),
- "api_flags_l4 == 0x%x != 0x%x\n", api_flags_l4, api_flags);
- check ("[L4]", "if L4 kernel ID flags matches KIP",
- (kernel_id_l4 == kernel_id),
- "kip_l4 == 0x%x != 0x%x\n", kernel_id_l4, kernel_id);
+ (kip == kip_ok),
+ "kip == %p != %p\n", kip, kip);
+
+ check_nr ("[L4]", "if L4 API version matches KIP",
+ api_version, api_version_ok);
+ check_nr ("[L4]", "if L4 API flags matches KIP",
+ api_flags, api_flags_ok);
+ check_nr ("[L4]", "if L4 kernel ID flags matches KIP",
+ kernel_id, kernel_id_ok);
+
+ kip = L4_GetKernelInterface ();
+ check ("[L4]", "L4_GetKernelInterface",
+ (kip == kip),
+ "kip == %p != %p\n", kip, kip);
}
#endif
- return kip;
+ return kip_ok;
}
@@ -111,6 +122,7 @@ test_magic ()
void
test_api_and_kernel_id ()
{
+#ifdef _L4_INTERFACE_INTERN
_L4_api_version_t api_version;
_L4_api_flags_t api_flags;
_L4_kernel_id_t kernel_id;
@@ -191,6 +203,7 @@ test_api_and_kernel_id ()
_L4_KERNEL_ID_L4KA_STRAWBERRY, 0x04);
check_nr ("[intern]", "_L4_KERNEL_SUBID_L4KA_STRAWBERRY",
_L4_KERNEL_SUBID_L4KA_STRAWBERRY, 0x03);
+#endif
#ifdef _L4_INTERFACE_L4
{
@@ -242,20 +255,22 @@ test_api_and_kernel_id ()
void
test_kernel_gen_date (_L4_kip_t kip)
{
- _L4_word_t year_ok = 2005;
- _L4_word_t month_ok = 1;
- _L4_word_t day_ok = 22;
+ word_t year_ok = 2005;
+ word_t month_ok = 1;
+ word_t day_ok = 22;
- _L4_word_t year;
- _L4_word_t month;
- _L4_word_t day;
+ word_t year;
+ word_t month;
+ word_t day;
+#ifdef _L4_INTERFACE_INTERN
_L4_kernel_gen_date (kip, &year, &month, &day);
check ("[intern]", "_L4_kernel_gen_date",
(year == year_ok && month == month_ok && day == day_ok),
"_L4_kernel_gen_date == %d/%d/%d != %d/%d/%d",
year, month, day, year_ok, month_ok, day_ok);
+#endif
#ifdef _L4_INTERFACE_GNU
l4_kernel_gen_date (&year, &month, &day);
@@ -288,51 +303,65 @@ test_kernel_gen_date (_L4_kip_t kip)
void
test_kernel_version (_L4_kip_t kip)
{
- _L4_word_t version_ok = 0;
- _L4_word_t subversion_ok = 4;
- _L4_word_t subsubversion_ok = 0;
- _L4_word_t full_version_ok = (version_ok << 24)
- | (subversion_ok << 16) | subsubversion_ok;
+ word_t version_ok = 0;
+ word_t subversion_ok = 4;
+ word_t subsubversion_ok = 0;
- _L4_word_t version;
- _L4_word_t subversion;
- _L4_word_t subsubversion;
+#ifdef _L4_INTERFACE_INTERN
+ {
+ word_t version;
+ word_t subversion;
+ word_t subsubversion;
- _L4_kernel_version (kip, &version, &subversion, &subsubversion);
+ _L4_kernel_version (kip, &version, &subversion, &subsubversion);
- check ("[intern]", "_L4_kernel_version",
- (version == version_ok && subversion == subversion_ok
- && subsubversion == subsubversion_ok),
- "_L4_kernel_version == %d.%d.%d != %d.%d.%d",
- version, subversion, subsubversion,
- version_ok, subversion_ok, subsubversion_ok);
+ check ("[intern]", "_L4_kernel_version",
+ (version == version_ok && subversion == subversion_ok
+ && subsubversion == subsubversion_ok),
+ "_L4_kernel_version == %d.%d.%d != %d.%d.%d",
+ version, subversion, subsubversion,
+ version_ok, subversion_ok, subsubversion_ok);
+ }
+#endif
#ifdef _L4_INTERFACE_GNU
- l4_kernel_version (&version, &subversion, &subsubversion);
-
- check ("[GNU]", "l4_kernel_version",
- (version == version_ok && subversion == subversion_ok
- && subsubversion == subsubversion_ok),
- "l4_kernel_version == %d.%d.%d != %d.%d.%d",
- version, subversion, subsubversion, version_ok,
- subversion_ok, subsubversion_ok);
-
- l4_kernel_version_from (kip, &version, &subversion, &subsubversion);
-
- check ("[GNU]", "l4_kernel_version_from",
- (version == version_ok && subversion == subversion_ok
- && subsubversion == subsubversion_ok),
- "l4_kernel_version_from == %d.%d.%d != %d.%d.%d",
- version, subversion, subsubversion, version_ok,
- subversion_ok, subsubversion_ok);
+ {
+ word_t version;
+ word_t subversion;
+ word_t subsubversion;
+
+ l4_kernel_version (&version, &subversion, &subsubversion);
+
+ check ("[GNU]", "l4_kernel_version",
+ (version == version_ok && subversion == subversion_ok
+ && subsubversion == subsubversion_ok),
+ "l4_kernel_version == %d.%d.%d != %d.%d.%d",
+ version, subversion, subsubversion, version_ok,
+ subversion_ok, subsubversion_ok);
+
+ l4_kernel_version_from (kip, &version, &subversion, &subsubversion);
+
+ check ("[GNU]", "l4_kernel_version_from",
+ (version == version_ok && subversion == subversion_ok
+ && subsubversion == subsubversion_ok),
+ "l4_kernel_version_from == %d.%d.%d != %d.%d.%d",
+ version, subversion, subsubversion, version_ok,
+ subversion_ok, subsubversion_ok);
+ }
#endif
#ifdef _L4_INTERFACE_L4
- version = L4_KernelVersion (kip);
+ {
+ word_t full_version_ok = (version_ok << 24)
+ | (subversion_ok << 16) | subsubversion_ok;
+ word_t version;
+
+ version = L4_KernelVersion (kip);
- check ("[L4]", "L4_KernelVersion",
- (version == full_version_ok),
- "L4_KernelVersion == 0x%x != 0x%x", version, full_version_ok);
+ check ("[L4]", "L4_KernelVersion",
+ (version == full_version_ok),
+ "L4_KernelVersion == 0x%x != 0x%x", version, full_version_ok);
+ }
#endif
}
@@ -341,74 +370,84 @@ test_kernel_version (_L4_kip_t kip)
void
test_kernel_supplier (_L4_kip_t kip)
{
- const char supplier_ok[] = _L4_KERNEL_SUPPLIER_UKA;
- char *supplier;
-
- supplier = (char[]) _L4_KERNEL_SUPPLIER_GMD;
- check ("[intern]", "_L4_KERNEL_SUPPLIER_GMD",
- (!strncmp (supplier, "GMD ", 4)),
- "_L4_KERNEL_SUPPLIER_GMD == '%.4s' != 'GMD '", supplier);
- supplier = (char[]) _L4_KERNEL_SUPPLIER_IBM;
- check ("[intern]", "_L4_KERNEL_SUPPLIER_IBM",
- (!strncmp (supplier, "IBM ", 4)),
- "_L4_KERNEL_SUPPLIER_IBM == '%.4s' != 'IBM '", supplier);
- supplier = (char[]) _L4_KERNEL_SUPPLIER_UNSW;
- check ("[intern]", "_L4_KERNEL_SUPPLIER_UNSW",
- (!strncmp (supplier, "UNSW", 4)),
- "_L4_KERNEL_SUPPLIER_UNSW == '%.4s' != 'UNSW'", supplier);
- supplier = (char[]) _L4_KERNEL_SUPPLIER_TUD;
- check ("[intern]", "_L4_KERNEL_SUPPLIER_TUD",
- (!strncmp (supplier, "TUD ", 4)),
- "_L4_KERNEL_SUPPLIER_TUD == '%.4s' != 'TUD '", supplier);
- supplier = (char[]) _L4_KERNEL_SUPPLIER_UKA;
- check ("[intern]", "_L4_KERNEL_SUPPLIER_UKA",
- (!strncmp (supplier, "UKa ", 4)),
- "_L4_KERNEL_SUPPLIER_UKA == '%.4s' != 'UKa '", supplier);
-
- supplier = _L4_kernel_supplier (kip);
- check ("[intern]", "_L4_kernel_supplier",
- (!strncmp (supplier, supplier_ok, sizeof (supplier_ok))),
- "_L4_kernel_supplier == '%.4s' != '%.4s'", supplier, supplier_ok);
+#ifdef _L4_INTERFACE_INTERN
+ {
+ const char supplier_ok[] = _L4_KERNEL_SUPPLIER_UKA;
+ char *supplier;
+
+ supplier = (char[]) _L4_KERNEL_SUPPLIER_GMD;
+ check ("[intern]", "_L4_KERNEL_SUPPLIER_GMD",
+ (!strncmp (supplier, "GMD ", 4)),
+ "_L4_KERNEL_SUPPLIER_GMD == '%.4s' != 'GMD '", supplier);
+ supplier = (char[]) _L4_KERNEL_SUPPLIER_IBM;
+ check ("[intern]", "_L4_KERNEL_SUPPLIER_IBM",
+ (!strncmp (supplier, "IBM ", 4)),
+ "_L4_KERNEL_SUPPLIER_IBM == '%.4s' != 'IBM '", supplier);
+ supplier = (char[]) _L4_KERNEL_SUPPLIER_UNSW;
+ check ("[intern]", "_L4_KERNEL_SUPPLIER_UNSW",
+ (!strncmp (supplier, "UNSW", 4)),
+ "_L4_KERNEL_SUPPLIER_UNSW == '%.4s' != 'UNSW'", supplier);
+ supplier = (char[]) _L4_KERNEL_SUPPLIER_TUD;
+ check ("[intern]", "_L4_KERNEL_SUPPLIER_TUD",
+ (!strncmp (supplier, "TUD ", 4)),
+ "_L4_KERNEL_SUPPLIER_TUD == '%.4s' != 'TUD '", supplier);
+ supplier = (char[]) _L4_KERNEL_SUPPLIER_UKA;
+ check ("[intern]", "_L4_KERNEL_SUPPLIER_UKA",
+ (!strncmp (supplier, "UKa ", 4)),
+ "_L4_KERNEL_SUPPLIER_UKA == '%.4s' != 'UKa '", supplier);
+
+ supplier = _L4_kernel_supplier (kip);
+ check ("[intern]", "_L4_kernel_supplier",
+ (!strncmp (supplier, supplier_ok, sizeof (supplier_ok))),
+ "_L4_kernel_supplier == '%.4s' != '%.4s'", supplier, supplier_ok);
+ }
+#endif
#ifdef _L4_INTERFACE_GNU
- check ("[GNU]", "L4_KERNEL_SUPPLIER_GMD",
- (!strncmp (((char[]) L4_KERNEL_SUPPLIER_GMD),
- ((char[]) _L4_KERNEL_SUPPLIER_GMD), 4)),
- "L4_KERNEL_SUPPLIER_GMD == '%.4s' != '%.4s'",
- (char[]) L4_KERNEL_SUPPLIER_GMD, (char[]) _L4_KERNEL_SUPPLIER_GMD);
- check ("[GNU]", "L4_KERNEL_SUPPLIER_IBM",
- (!strncmp (((char[]) L4_KERNEL_SUPPLIER_IBM),
- ((char[]) _L4_KERNEL_SUPPLIER_IBM), 4)),
- "L4_KERNEL_SUPPLIER_IBM == '%.4s' != '%.4s'",
- (char[]) L4_KERNEL_SUPPLIER_IBM, (char[]) _L4_KERNEL_SUPPLIER_IBM);
- check ("[GNU]", "L4_KERNEL_SUPPLIER_UNSW",
- (!strncmp (((char[]) L4_KERNEL_SUPPLIER_UNSW),
- ((char[]) _L4_KERNEL_SUPPLIER_UNSW), 4)),
- "L4_KERNEL_SUPPLIER_UNSW == '%.4s' != '%.4s'",
- (char[]) L4_KERNEL_SUPPLIER_UNSW, (char[]) _L4_KERNEL_SUPPLIER_UNSW);
- check ("[GNU]", "L4_KERNEL_SUPPLIER_TUD",
- (!strncmp (((char[]) L4_KERNEL_SUPPLIER_TUD),
- ((char[]) _L4_KERNEL_SUPPLIER_TUD), 4)),
- "L4_KERNEL_SUPPLIER_TUD == '%.4s' != '%.4s'",
- (char[]) L4_KERNEL_SUPPLIER_TUD, (char[]) _L4_KERNEL_SUPPLIER_TUD);
- check ("[GNU]", "L4_KERNEL_SUPPLIER_UKA",
- (!strncmp (((char[]) L4_KERNEL_SUPPLIER_UKA),
- ((char[]) _L4_KERNEL_SUPPLIER_UKA), 4)),
- "L4_KERNEL_SUPPLIER_UKA == '%.4s' != '%.4s'",
- (char[]) L4_KERNEL_SUPPLIER_UKA, (char[]) _L4_KERNEL_SUPPLIER_UKA);
-
- supplier = l4_kernel_supplier_from (kip);
- check ("[GNU]", "l4_kernel_supplier_from",
- (!strncmp (supplier, supplier_ok, sizeof (supplier_ok))),
- "l4_kernel_supplier_from == '%.4s' != '%.4s'", supplier, supplier_ok);
-
- supplier = l4_kernel_supplier ();
- check ("[GNU]", "l4_kernel_supplier",
- (!strncmp (supplier, supplier_ok, sizeof (supplier_ok))),
- "l4_kernel_supplier == '%.4s' != '%.4s'", supplier, supplier_ok);
+ {
+ const char supplier_ok[] = _L4_KERNEL_SUPPLIER_UKA;
+ char *supplier;
+
+ check ("[GNU]", "L4_KERNEL_SUPPLIER_GMD",
+ (!strncmp (((char[]) L4_KERNEL_SUPPLIER_GMD),
+ ((char[]) _L4_KERNEL_SUPPLIER_GMD), 4)),
+ "L4_KERNEL_SUPPLIER_GMD == '%.4s' != '%.4s'",
+ (char[]) L4_KERNEL_SUPPLIER_GMD, (char[]) _L4_KERNEL_SUPPLIER_GMD);
+ check ("[GNU]", "L4_KERNEL_SUPPLIER_IBM",
+ (!strncmp (((char[]) L4_KERNEL_SUPPLIER_IBM),
+ ((char[]) _L4_KERNEL_SUPPLIER_IBM), 4)),
+ "L4_KERNEL_SUPPLIER_IBM == '%.4s' != '%.4s'",
+ (char[]) L4_KERNEL_SUPPLIER_IBM, (char[]) _L4_KERNEL_SUPPLIER_IBM);
+ check ("[GNU]", "L4_KERNEL_SUPPLIER_UNSW",
+ (!strncmp (((char[]) L4_KERNEL_SUPPLIER_UNSW),
+ ((char[]) _L4_KERNEL_SUPPLIER_UNSW), 4)),
+ "L4_KERNEL_SUPPLIER_UNSW == '%.4s' != '%.4s'",
+ (char[]) L4_KERNEL_SUPPLIER_UNSW,
+ (char[]) _L4_KERNEL_SUPPLIER_UNSW);
+ check ("[GNU]", "L4_KERNEL_SUPPLIER_TUD",
+ (!strncmp (((char[]) L4_KERNEL_SUPPLIER_TUD),
+ ((char[]) _L4_KERNEL_SUPPLIER_TUD), 4)),
+ "L4_KERNEL_SUPPLIER_TUD == '%.4s' != '%.4s'",
+ (char[]) L4_KERNEL_SUPPLIER_TUD, (char[]) _L4_KERNEL_SUPPLIER_TUD);
+ check ("[GNU]", "L4_KERNEL_SUPPLIER_UKA",
+ (!strncmp (((char[]) L4_KERNEL_SUPPLIER_UKA),
+ ((char[]) _L4_KERNEL_SUPPLIER_UKA), 4)),
+ "L4_KERNEL_SUPPLIER_UKA == '%.4s' != '%.4s'",
+ (char[]) L4_KERNEL_SUPPLIER_UKA, (char[]) _L4_KERNEL_SUPPLIER_UKA);
+
+ supplier = l4_kernel_supplier_from (kip);
+ check ("[GNU]", "l4_kernel_supplier_from",
+ (!strncmp (supplier, supplier_ok, sizeof (supplier_ok))),
+ "l4_kernel_supplier_from == '%.4s' != '%.4s'",
+ supplier, supplier_ok);
+
+ supplier = l4_kernel_supplier ();
+ check ("[GNU]", "l4_kernel_supplier",
+ (!strncmp (supplier, supplier_ok, sizeof (supplier_ok))),
+ "l4_kernel_supplier == '%.4s' != '%.4s'", supplier, supplier_ok);
+ }
#endif
-
#ifdef _L4_INTERFACE_L4
{
L4_Word_t supl_ok;
@@ -444,11 +483,13 @@ test_kernel_version_string (_L4_kip_t kip)
"using gcc version 3.3.4 (Debian 1:3.3.4-13)";
char *version_string;
+#ifdef _L4_INTERFACE_INTERN
version_string = _L4_kernel_version_string (kip);
check ("[intern]", "_L4_kernel_version_string",
(!strcmp (version_string, version_string_ok)),
"_L4_kernel_version_string == '%s' != '%s'",
version_string, version_string_ok);
+#endif
#ifdef _L4_INTERFACE_GNU
version_string = l4_kernel_version_string_from (kip);
@@ -481,11 +522,12 @@ test_kernel_feature (_L4_kip_t kip)
const char *feature_ok[] = { "smallspaces", NULL };
char *feature;
- _L4_word_t num = 0;
+ word_t num = 0;
int last_seen = 0;
do
{
+ /* FIXME: Support [!_L4_INTERFACE_INTERN] (by code duplication?). */
feature = _L4_feature (kip, num);
if (!last_seen && feature_ok[num] && feature)
@@ -530,15 +572,17 @@ test_kernel_feature (_L4_kip_t kip)
void
test_processor_info (_L4_kip_t kip)
{
- _L4_word_t processors_ok = 2;
- _L4_word_t internal_freq_ok[] = { 2809310, 2809311 };
- _L4_word_t external_freq_ok[] = { 0, 0 };
- _L4_word_t proc_desc_size_ok = 16;
- _L4_word_t num;
+ word_t processors_ok = 2;
+ word_t internal_freq_ok[] = { 2809310, 2809311 };
+ word_t external_freq_ok[] = { 0, 0 };
+ word_t proc_desc_size_ok = 16;
+ word_t num;
_L4_proc_desc_t proc_desc_prev = 0;
+#ifdef _L4_INTERFACE_INTERN
check_nr ("[intern]", "_L4_num_processors",
_L4_num_processors (kip), processors_ok);
+#endif
#ifdef _L4_INTERFACE_GNU
check_nr ("[GNU]", "l4_num_processors_from",
@@ -548,17 +592,30 @@ test_processor_info (_L4_kip_t kip)
#endif
#ifdef _L4_INTERFACE_L4
+ {
+ volatile L4_ProcDesc_t proc_desc;
+ volatile L4_Word_t raw;
+
+ raw = proc_desc.raw[0];
+ raw = proc_desc.raw[1];
+ raw = proc_desc.raw[2];
+ raw = proc_desc.raw[3];
+ }
+
check_nr ("[L4]", "L4_NumProcessors",
L4_NumProcessors (kip), processors_ok);
#endif
+#ifdef _L4_INTERFACE_INTERN
check_nr ("[intern]", "processor_info.log2_size",
(1 << kip->processor_info.log2_size), proc_desc_size_ok);
+#endif
for (num = 0; num < _L4_num_processors (kip); num++)
{
_L4_proc_desc_t proc_desc;
+ /* FIXME: Support [!_L4_INTERFACE_INTERN] (by code duplication?). */
proc_desc = _L4_proc_desc (kip, num);
check ("[intern]", "_L4_proc_desc (once per cpu)",
(proc_desc != NULL),
@@ -605,7 +662,7 @@ test_processor_info (_L4_kip_t kip)
#ifdef _L4_INTERFACE_L4
{
L4_ProcDesc_t *proc_desc_l4 = L4_ProcDesc (kip, num);
-
+
check ("[L4]", "L4_ProcDesc",
((void *) proc_desc_l4 == (void *) proc_desc),
"L4_ProcDesc (kip, %i) == %p != %p",
@@ -642,13 +699,15 @@ test_processor_info (_L4_kip_t kip)
void
test_page_info (_L4_kip_t kip)
{
- _L4_word_t page_size_mask_ok = 0x00401000;
- _L4_word_t page_rights_ok = 0x6;
+ word_t page_size_mask_ok = 0x00401000;
+ word_t page_rights_ok = 0x6;
+#ifdef _L4_INTERFACE_INTERN
check_nr ("[intern]", "_L4_page_size_mask",
_L4_page_size_mask (kip), page_size_mask_ok);
check_nr ("[intern]", "_L4_page_rights",
_L4_page_rights (kip), page_rights_ok);
+#endif
#ifdef _L4_INTERFACE_GNU
check_nr ("[GNU]", "l4_page_size_mask_from",
@@ -669,6 +728,228 @@ test_page_info (_L4_kip_t kip)
}
+/* Test the thread info field. */
+void
+test_thread_info (_L4_kip_t kip)
+{
+ word_t thread_id_bits_ok = 0x11;
+ word_t thread_id_system_base_ok = 0x10;
+ word_t thread_id_user_base_ok = 0x30;
+
+#ifdef _L4_INTERFACE_INTERN
+ check_nr ("[intern]", "_L4_thread_id_bits",
+ _L4_thread_id_bits (kip), thread_id_bits_ok);
+ check_nr ("[intern]", "_L4_thread_system_base",
+ _L4_thread_system_base (kip), thread_id_system_base_ok);
+ check_nr ("[intern]", "_L4_thread_user_base",
+ _L4_thread_user_base (kip), thread_id_user_base_ok);
+#endif
+
+#ifdef _L4_INTERFACE_GNU
+ check_nr ("[GNU]", "l4_thread_id_bits_from",
+ l4_thread_id_bits_from (kip), thread_id_bits_ok);
+ check_nr ("[GNU]", "l4_thread_id_bits",
+ l4_thread_id_bits (), thread_id_bits_ok);
+ check_nr ("[GNU]", "l4_thread_system_base_from",
+ l4_thread_system_base_from (kip), thread_id_system_base_ok);
+ check_nr ("[GNU]", "l4_thread_system_base",
+ l4_thread_system_base (), thread_id_system_base_ok);
+ check_nr ("[GNU]", "l4_thread_user_base_from",
+ l4_thread_user_base_from (kip), thread_id_user_base_ok);
+ check_nr ("[GNU]", "l4_thread_user_base",
+ l4_thread_user_base (), thread_id_user_base_ok);
+#endif
+
+#ifdef _L4_INTERFACE_L4
+ check_nr ("[intern]", "L4_ThreadIdBits",
+ L4_ThreadIdBits (kip), thread_id_bits_ok);
+ check_nr ("[intern]", "L4_ThreadIdSystemBase",
+ L4_ThreadIdSystemBase (kip), thread_id_system_base_ok);
+ check_nr ("[intern]", "L4_ThreadIdUserBase",
+ L4_ThreadIdUserBase (kip), thread_id_user_base_ok);
+#endif
+}
+
+
+/* Test the clock info field. */
+void
+test_clock_info (_L4_kip_t kip)
+{
+ word_t read_precision_ok = 0;
+ word_t schedule_precision_ok = 0;
+
+#ifdef _L4_INTERFACE_INTERN
+ check_nr ("[intern]", "_L4_read_precision",
+ _L4_read_precision (kip), read_precision_ok);
+ check_nr ("[intern]", "_L4_schedule_precision",
+ _L4_schedule_precision (kip), schedule_precision_ok);
+#endif
+
+#ifdef _L4_INTERFACE_GNU
+ check_nr ("[GNU]", "l4_read_precision_from",
+ l4_read_precision_from (kip), read_precision_ok);
+ check_nr ("[GNU]", "l4_read_precision",
+ l4_read_precision (), read_precision_ok);
+ check_nr ("[GNU]", "l4_schedule_precision_from",
+ l4_schedule_precision_from (kip), schedule_precision_ok);
+ check_nr ("[GNU]", "l4_schedule_precision",
+ l4_schedule_precision (), schedule_precision_ok);
+#endif
+
+#ifdef _L4_INTERFACE_L4
+ check_nr ("[L4]", "L4_ReadPrecision",
+ L4_ReadPrecision (kip), read_precision_ok);
+ check_nr ("[L4]", "l4_SchedulePrecision",
+ L4_SchedulePrecision (kip), schedule_precision_ok);
+#endif
+}
+
+
+/* Test the utcb info field. */
+void
+test_utcb_info (_L4_kip_t kip)
+{
+ word_t utcb_align_log2_ok = 0x09;
+ word_t utcb_area_size_log2_ok = 0x0c;
+ word_t utcb_size_ok = 0x200;
+
+#ifdef _L4_INTERFACE_INTERN
+ check_nr ("[intern]", "_L4_utcb_area_size_log2",
+ _L4_utcb_area_size_log2 (kip), utcb_area_size_log2_ok);
+ check_nr ("[intern]", "_L4_utcb_alignment_log2",
+ _L4_utcb_alignment_log2 (kip), utcb_align_log2_ok);
+ check_nr ("[intern]", "_L4_utcb_size",
+ _L4_utcb_size (kip), utcb_size_ok);
+#endif
+
+#ifdef _L4_INTERFACE_GNU
+ check_nr ("[GNU]", "l4_utcb_area_size_log2_from",
+ l4_utcb_area_size_log2_from (kip), utcb_area_size_log2_ok);
+ check_nr ("[GNU]", "l4_utcb_area_size_log2",
+ l4_utcb_area_size_log2 (), utcb_area_size_log2_ok);
+ check_nr ("[GNU]", "l4_utcb_area_size",
+ l4_utcb_area_size (), 1 << utcb_area_size_log2_ok);
+ check_nr ("[GNU]", "l4_utcb_alignment_log2_from",
+ l4_utcb_alignment_log2_from (kip), utcb_align_log2_ok);
+ check_nr ("[GNU]", "l4_utcb_alignment_log2",
+ l4_utcb_alignment_log2 (), utcb_align_log2_ok);
+ check_nr ("[GNU]", "l4_utcb_alignment_log2",
+ l4_utcb_alignment (), 1 << utcb_align_log2_ok);
+ check_nr ("[GNU]", "l4_utcb_size_from",
+ l4_utcb_size_from (kip), utcb_size_ok);
+ check_nr ("[GNU]", "l4_utcb_size",
+ l4_utcb_size (), utcb_size_ok);
+#endif
+
+#ifdef _L4_INTERFACE_L4
+ check_nr ("[L4]", "L4_UtcbAreaSizeLog2",
+ L4_UtcbAreaSizeLog2 (kip), utcb_area_size_log2_ok);
+ check_nr ("[L4]", "L4_UtcbAlignmentLog2",
+ L4_UtcbAlignmentLog2 (kip), utcb_align_log2_ok);
+ check_nr ("[L4]", "L4_UtcbSize",
+ L4_UtcbSize (kip), utcb_size_ok);
+#endif
+}
+
+
+/* Test the kip area info field. */
+void
+test_kip_area_info (_L4_kip_t kip)
+{
+ word_t kip_area_size_log2_ok = 0x0c;
+
+#ifdef _L4_INTERFACE_INTERN
+ check_nr ("[intern]", "_L4_kip_area_size_log2",
+ _L4_kip_area_size_log2 (kip), kip_area_size_log2_ok);
+#endif
+
+#ifdef _L4_INTERFACE_GNU
+ check_nr ("[GNU]", "l4_kip_area_size_log2_from",
+ l4_kip_area_size_log2_from (kip), kip_area_size_log2_ok);
+ check_nr ("[GNU]", "l4_kip_area_size_log2",
+ l4_kip_area_size_log2 (), kip_area_size_log2_ok);
+ check_nr ("[GNU]", "l4_kip_area_size",
+ l4_kip_area_size (), 1 << kip_area_size_log2_ok);
+#endif
+
+#ifdef _L4_INTERFACE_L4
+ check_nr ("[L4]", "L4_KipAreaSizeLog2",
+ L4_KipAreaSizeLog2 (kip), kip_area_size_log2_ok);
+#endif
+}
+
+
+/* Test the boot info field. */
+void
+test_boot_info (_L4_kip_t kip)
+{
+ word_t boot_info_ok = 0x32600;
+
+#ifdef _L4_INTERFACE_INTERN
+ check_nr ("[intern]", "_L4_boot_info",
+ _L4_boot_info (kip), boot_info_ok);
+#endif
+
+#ifdef _L4_INTERFACE_GNU
+ check_nr ("[GNU]", "l4_boot_info_from",
+ l4_boot_info_from (kip), boot_info_ok);
+ check_nr ("[GNU]", "l4_boot_info",
+ l4_boot_info (), boot_info_ok);
+#endif
+
+#ifdef _L4_INTERFACE_L4
+ check_nr ("[L4]", "L4_BootInfo",
+ L4_BootInfo (kip), boot_info_ok);
+#endif
+}
+
+
+/* Test the system call links. */
+void
+test_syscalls (_L4_kip_t kip)
+{
+#ifdef _L4_INTERFACE_INTERN
+ word_t space_control_ok = 0x910;
+ word_t thread_control_ok = 0x8e0;
+ word_t processor_control_ok = 0x930;
+ word_t memory_control_ok = 0x940;
+ word_t ipc_ok = 0x800;
+ word_t lipc_ok = 0x830;
+ word_t unmap_ok = 0x8d0;
+ word_t exchange_registers_ok = 0x860;
+ word_t system_clock_ok = 0x870;
+ word_t thread_switch_ok = 0x8b0;
+ word_t schedule_ok = 0x8c0;
+ word_t arch0_ok = 0x950;
+ word_t arch1_ok = 0;
+ word_t arch2_ok = 0;
+ word_t arch3_ok = 0;
+
+#define CHECK_ONE_SYSCALL_LINK(name) \
+ check_nr ("[intern]", #name " syscall link", \
+ kip->name, name ## _ok);
+
+ CHECK_ONE_SYSCALL_LINK (space_control);
+ CHECK_ONE_SYSCALL_LINK (thread_control);
+ CHECK_ONE_SYSCALL_LINK (processor_control);
+ CHECK_ONE_SYSCALL_LINK (memory_control);
+ CHECK_ONE_SYSCALL_LINK (ipc);
+ CHECK_ONE_SYSCALL_LINK (lipc);
+ CHECK_ONE_SYSCALL_LINK (unmap);
+ CHECK_ONE_SYSCALL_LINK (exchange_registers);
+ CHECK_ONE_SYSCALL_LINK (system_clock);
+ CHECK_ONE_SYSCALL_LINK (thread_switch);
+ CHECK_ONE_SYSCALL_LINK (schedule);
+ CHECK_ONE_SYSCALL_LINK (arch0);
+ CHECK_ONE_SYSCALL_LINK (arch1);
+ CHECK_ONE_SYSCALL_LINK (arch2);
+ CHECK_ONE_SYSCALL_LINK (arch3);
+#undef CHECK_ONE_SYSCALL_LINK
+#endif
+
+}
+
+
void
test (void)
{
@@ -684,6 +965,12 @@ test (void)
test_kernel_feature (kip);
test_processor_info (kip);
-
test_page_info (kip);
+ test_thread_info (kip);
+ test_clock_info (kip);
+ test_utcb_info (kip);
+ test_kip_area_info (kip);
+ test_boot_info (kip);
+
+ test_syscalls (kip);
}
diff --git a/libl4/tests/t-l4-message.c b/libl4/tests/t-l4-message.c
index 8700ffe..1c40ee8 100644
--- a/libl4/tests/t-l4-message.c
+++ b/libl4/tests/t-l4-message.c
@@ -1,4 +1,4 @@
-/* t-vregs.c - A test for the interfaces to the L4 message registers.
+/* t-message.c - A test for the interfaces to the L4 message registers.
Copyright (C) 2005 Free Software Foundation, Inc.
Written by Matthieu Lemerre <racin@free.fr> and
Marcus Brinkmann <marcus@gnu.org>.
@@ -35,10 +35,15 @@
#include <l4/message.h>
+#define L4_NUM_MRS_OK 64
+#define L4_NUM_BRS_OK 33
+
+
/* Test the message register MR with value VAL_OK. */
void
-test_one_mr (int mr, _L4_word_t val_ok)
+test_one_mr (int mr, word_t val_ok)
{
+#ifdef _L4_INTERFACE_INTERN
{
_L4_word_t val;
char *msg;
@@ -53,6 +58,7 @@ test_one_mr (int mr, _L4_word_t val_ok)
_L4_store_mr (mr, &val);
check_nr ("[intern]", msg, val, val_ok);
}
+#endif
#ifdef _L4_INTERFACE_GNU
{
@@ -95,6 +101,7 @@ test_one_mr (int mr, _L4_word_t val_ok)
void
test_many_mrs (int start_mr, int nr, _L4_word_t *values_ok)
{
+#ifdef _L4_INTERFACE_INTERN
{
_L4_word_t values[nr];
int i;
@@ -117,6 +124,7 @@ test_many_mrs (int start_mr, int nr, _L4_word_t *values_ok)
check_nr ("[intern]", msg, values[i], values_ok[i]);
}
}
+#endif
#ifdef _L4_INTERFACE_GNU
{
@@ -177,7 +185,7 @@ test_mrs (void)
{
int start_mr;
int nr;
- _L4_word_t values[L4_NUM_MRS];
+ word_t values[L4_NUM_MRS_OK];
} tests[] =
{
{ 0, 1, { 22 } },
@@ -195,9 +203,11 @@ test_mrs (void)
int nr = sizeof (tests) / sizeof (tests[0]);
int i;
- check_nr ("[intern]", "_L4_NUM_MRS", _L4_NUM_MRS, 64);
+#ifdef _L4_INTERFACE_INTERN
+ check_nr ("[intern]", "_L4_NUM_MRS", _L4_NUM_MRS, L4_NUM_MRS_OK);
+#endif
#ifdef _L4_INTERFACE_GNU
- check_nr ("[GNU]", "L4_NUM_MRS", L4_NUM_MRS, 64);
+ check_nr ("[GNU]", "L4_NUM_MRS", L4_NUM_MRS, L4_NUM_MRS_OK);
#endif
/* FIXME: There is no L4 interface for this. */
@@ -213,6 +223,7 @@ test_mrs (void)
void
test_one_br (int br, _L4_word_t val_ok)
{
+#ifdef _L4_INTERFACE_INTERN
{
_L4_word_t val;
char *msg;
@@ -227,6 +238,7 @@ test_one_br (int br, _L4_word_t val_ok)
_L4_store_br (br, &val);
check_nr ("[intern]", msg, val, val_ok);
}
+#endif
#ifdef _L4_INTERFACE_GNU
{
@@ -269,6 +281,7 @@ test_one_br (int br, _L4_word_t val_ok)
void
test_many_brs (int start_br, int nr, _L4_word_t *values_ok)
{
+#ifdef _L4_INTERFACE_INTERN
{
_L4_word_t values[nr];
int i;
@@ -291,6 +304,7 @@ test_many_brs (int start_br, int nr, _L4_word_t *values_ok)
check_nr ("[intern]", msg, values[i], values_ok[i]);
}
}
+#endif
#ifdef _L4_INTERFACE_GNU
{
@@ -351,7 +365,7 @@ test_brs (void)
{
int start_br;
int nr;
- _L4_word_t values[L4_NUM_BRS];
+ word_t values[L4_NUM_BRS_OK];
} tests[] =
{
{ 0, 1, { 24 } },
@@ -366,9 +380,11 @@ test_brs (void)
int nr = sizeof (tests) / sizeof (tests[0]);
int i;
- check_nr ("[intern]", "_L4_NUM_BRS", _L4_NUM_BRS, 33);
+#ifdef _L4_INTERFACE_INTERN
+ check_nr ("[intern]", "_L4_NUM_BRS", _L4_NUM_BRS, L4_NUM_BRS_OK);
+#endif
#ifdef _L4_INTERFACE_GNU
- check_nr ("[GNU]", "L4_NUM_BRS", L4_NUM_BRS, 33);
+ check_nr ("[GNU]", "L4_NUM_BRS", L4_NUM_BRS, L4_NUM_BRS_OK);
#endif
/* FIXME: There is no L4 interface for this. */