modified tests. The results on BeOS R5 do not match the BeBook description.
$ /boot/home/develop/haiku/generated/objects/haiku/x86/debug_1/tests/system/kernel/port_close_test_1 created port 2269 write port result 0x00000000 (No Error) write port result 0x00000000 (No Error) close port result 0x00000000 (No Error) write port result 0x80001200 (Bad port ID) port_buffer_size -2147479552 (0x80001000) (Bad semaphore ID) read port code 1234, size 10 (0x0000000a) (Unknown Error (10)) port_buffer_size -2147479552 (0x80001000) (Bad semaphore ID) read port code 5678, size 20 (0x00000014) (Unknown Error (20)) should block now port_buffer_size -2147479552 (0x80001000) (Bad semaphore ID) $ /boot/home/develop/haiku/generated/objects/haiku/x86/debug_1/tests/system/kernel/port_close_test_2 created port 2270 write port result 0x00000000 (No Error) write port result 0x00000000 (No Error) close port result 0x00000000 (No Error) write port result 0x80001200 (Bad port ID) port_buffer_size -2147479552 (0x80001000) (Bad semaphore ID) read port code 1234, size 10 (0x0000000a) (Unknown Error (10)) port_buffer_size -2147479552 (0x80001000) (Bad semaphore ID) read port code 5678, size 20 (0x00000014) (Unknown Error (20)) should block now read port code 5678, size -2147479040 (0x80001200) (Bad port ID) $ /boot/home/develop/haiku/generated/objects/haiku/x86/debug_1/tests/system/kernel/port_delete_test created port 2271 write port result 0x00000000 (No Error) write port result 0x00000000 (No Error) delete port result 0x00000000 (No Error) everything should fail now write port result 0x80001200 (Bad port ID) port_buffer_size -2147479040 (0x80001200) (Bad port ID) read port code 0, size -2147479040 (0x80001200) (Bad port ID) $ git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16645 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
89107618d5
commit
da9b743b20
@ -11,6 +11,10 @@ SimpleTest port_close_test_2 :
|
||||
port_close_test_2.cpp
|
||||
;
|
||||
|
||||
SimpleTest port_delete_test :
|
||||
port_delete_test.cpp
|
||||
;
|
||||
|
||||
SimpleTest transfer_area_test :
|
||||
transfer_area_test.cpp
|
||||
;
|
||||
|
@ -37,25 +37,25 @@ main()
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = port_buffer_size(id);
|
||||
printf("port_buffer_size %ld\n", size);
|
||||
printf("port_buffer_size %ld (0x%08lx) (%s)\n", size, size, strerror(size));
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = read_port(id, &code, data, sizeof(data));
|
||||
printf("read port size %ld, code %lx, result 0x%08lx (%s)\n", size, code, s, strerror(s));
|
||||
printf("read port code %lx, size %ld (0x%08lx) (%s)\n", code, size, size, strerror(size));
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = port_buffer_size(id);
|
||||
printf("port_buffer_size %ld\n", size);
|
||||
printf("port_buffer_size %ld (0x%08lx) (%s)\n", size, size, strerror(size));
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = read_port(id, &code, data, sizeof(data));
|
||||
printf("read port size %ld, code %lx, result 0x%08lx (%s)\n", size, code, s, strerror(s));
|
||||
printf("read port code %lx, size %ld (0x%08lx) (%s)\n", code, size, size, strerror(size));
|
||||
|
||||
printf("should block now\n");
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = port_buffer_size(id);
|
||||
printf("port_buffer_size %ld\n", size);
|
||||
printf("port_buffer_size %ld (0x%08lx) (%s)\n", size, size, strerror(size));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -37,25 +37,25 @@ main()
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = port_buffer_size(id);
|
||||
printf("port_buffer_size %ld\n", size);
|
||||
printf("port_buffer_size %ld (0x%08lx) (%s)\n", size, size, strerror(size));
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = read_port(id, &code, data, sizeof(data));
|
||||
printf("read port size %ld, code %lx, result 0x%08lx (%s)\n", size, code, s, strerror(s));
|
||||
printf("read port code %lx, size %ld (0x%08lx) (%s)\n", code, size, size, strerror(size));
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = port_buffer_size(id);
|
||||
printf("port_buffer_size %ld\n", size);
|
||||
printf("port_buffer_size %ld (0x%08lx) (%s)\n", size, size, strerror(size));
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = read_port(id, &code, data, sizeof(data));
|
||||
printf("read port size %ld, code %lx, result 0x%08lx (%s)\n", size, code, s, strerror(s));
|
||||
printf("read port code %lx, size %ld (0x%08lx) (%s)\n", code, size, size, strerror(size));
|
||||
|
||||
printf("should block now\n");
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = read_port(id, &code, data, sizeof(data));
|
||||
printf("read port size %ld, code %lx, result 0x%08lx (%s)\n", size, code, s, strerror(s));
|
||||
printf("read port code %lx, size %ld (0x%08lx) (%s)\n", code, size, size, strerror(size));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
49
src/tests/system/kernel/port_delete_test.cpp
Normal file
49
src/tests/system/kernel/port_delete_test.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2006, Marcus Overhagen, <marcus@overhagen.de>
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
port_id id;
|
||||
status_t s;
|
||||
size_t size;
|
||||
int32 code;
|
||||
|
||||
char data[100];
|
||||
|
||||
|
||||
id = create_port(10, "test port");
|
||||
printf("created port %ld\n", id);
|
||||
|
||||
s = write_port(id, 0x1234, data, 10);
|
||||
printf("write port result 0x%08lx (%s)\n", s, strerror(s));
|
||||
|
||||
s = write_port(id, 0x5678, data, 20);
|
||||
printf("write port result 0x%08lx (%s)\n", s, strerror(s));
|
||||
|
||||
s = delete_port(id);
|
||||
printf("delete port result 0x%08lx (%s)\n", s, strerror(s));
|
||||
|
||||
printf("everything should fail now\n");
|
||||
|
||||
// BeBook: does return B_BAD_PORT_ID if port was closed
|
||||
s = write_port(id, 0x5678, data, 20);
|
||||
printf("write port result 0x%08lx (%s)\n", s, strerror(s));
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = port_buffer_size(id);
|
||||
printf("port_buffer_size %ld (0x%08lx) (%s)\n", size, size, strerror(size));
|
||||
|
||||
// BeBook: does block when port is empty, and unblocks when port is written to or deleted
|
||||
size = read_port(id, &code, data, sizeof(data));
|
||||
printf("read port code %lx, size %ld (0x%08lx) (%s)\n", code, size, size, strerror(size));
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user