From 538abf58b35c70c6d169f4f18880b3b7c59abcae Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 1 Sep 2007 14:42:59 +0000 Subject: [PATCH] Added test case for the r/o text segment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22138 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/set_area_protection_test1.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/tests/system/kernel/set_area_protection_test1.cpp b/src/tests/system/kernel/set_area_protection_test1.cpp index 336b18b4dc..de674bdb75 100644 --- a/src/tests/system/kernel/set_area_protection_test1.cpp +++ b/src/tests/system/kernel/set_area_protection_test1.cpp @@ -6,6 +6,14 @@ #include + +int +test_function() +{ + return 0; +} + + static area_id create_test_area(const char* name, int** address, uint32 protection) { @@ -41,19 +49,23 @@ int main() { // allocate read-only areas - const int kAreaCount = 3; + const int kAreaCount = 4; area_id areas[kAreaCount]; int* areaAddresses[kAreaCount]; areas[0] = create_test_area("area0", &areaAddresses[0], B_READ_AREA); areas[1] = create_test_area("area1", &areaAddresses[1], B_READ_AREA); areas[2] = create_test_area("area2", &areaAddresses[2], B_READ_AREA); + areaAddresses[3] = (int*)test_function; + areas[3] = area_for(areaAddresses[3]); int* area2CloneAddress; /*area_id area2Clone =*/ clone_test_area("area2clone", &area2CloneAddress, B_READ_AREA | B_WRITE_AREA, areas[2]); - for (int i = 0; i < kAreaCount; i++) - printf("parent: areas[%d]: %ld, %p\n", i, areas[i], areaAddresses[i]); + for (int i = 0; i < kAreaCount; i++) { + printf("parent: areas[%d]: %ld, %p (%d)\n", i, areas[i], + areaAddresses[i], *areaAddresses[i]); + } // fork() pid_t pid = fork();