* Added fibo_load_image test based on Manuel's fibo test from NewOS - doesn't work yet
due to problems with wait_for_thread(). * Minor cleanup to the Jamfile. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19757 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2d75f771bf
commit
cbe5f24524
|
@ -3,65 +3,30 @@ SubDir HAIKU_TOP src tests system kernel ;
|
|||
UsePrivateHeaders kernel ;
|
||||
UseHeaders $(TARGET_PRIVATE_KERNEL_HEADERS) : true ;
|
||||
|
||||
SimpleTest port_close_test_1 :
|
||||
port_close_test_1.cpp
|
||||
;
|
||||
SimpleTest fibo_load_image : fibo_load_image.cpp ;
|
||||
#SimpleTest fibo_fork : fibo_fork.cpp ;
|
||||
#SimpleTest fibo_exec : fibo_exec.cpp ;
|
||||
|
||||
SimpleTest port_close_test_2 :
|
||||
port_close_test_2.cpp
|
||||
;
|
||||
SimpleTest port_close_test_1 : port_close_test_1.cpp ;
|
||||
SimpleTest port_close_test_2 : port_close_test_2.cpp ;
|
||||
|
||||
SimpleTest port_delete_test :
|
||||
port_delete_test.cpp
|
||||
;
|
||||
SimpleTest port_delete_test : port_delete_test.cpp ;
|
||||
|
||||
SimpleTest port_wakeup_test_1 :
|
||||
port_wakeup_test_1.cpp
|
||||
;
|
||||
SimpleTest port_wakeup_test_1 : port_wakeup_test_1.cpp ;
|
||||
SimpleTest port_wakeup_test_2 : port_wakeup_test_2.cpp ;
|
||||
SimpleTest port_wakeup_test_3 : port_wakeup_test_3.cpp ;
|
||||
SimpleTest port_wakeup_test_4 : port_wakeup_test_4.cpp ;
|
||||
SimpleTest port_wakeup_test_5 : port_wakeup_test_5.cpp ;
|
||||
SimpleTest port_wakeup_test_6 : port_wakeup_test_6.cpp ;
|
||||
SimpleTest port_wakeup_test_7 : port_wakeup_test_7.cpp ;
|
||||
SimpleTest port_wakeup_test_8 : port_wakeup_test_8.cpp ;
|
||||
SimpleTest port_wakeup_test_9 : port_wakeup_test_9.cpp ;
|
||||
|
||||
SimpleTest port_wakeup_test_2 :
|
||||
port_wakeup_test_2.cpp
|
||||
;
|
||||
SimpleTest transfer_area_test : transfer_area_test.cpp ;
|
||||
|
||||
SimpleTest port_wakeup_test_3 :
|
||||
port_wakeup_test_3.cpp
|
||||
;
|
||||
SimpleTest syscall_time : syscall_time.cpp ;
|
||||
|
||||
SimpleTest port_wakeup_test_4 :
|
||||
port_wakeup_test_4.cpp
|
||||
;
|
||||
|
||||
SimpleTest port_wakeup_test_5 :
|
||||
port_wakeup_test_5.cpp
|
||||
;
|
||||
|
||||
SimpleTest port_wakeup_test_6 :
|
||||
port_wakeup_test_6.cpp
|
||||
;
|
||||
|
||||
SimpleTest port_wakeup_test_7 :
|
||||
port_wakeup_test_7.cpp
|
||||
;
|
||||
|
||||
SimpleTest port_wakeup_test_8 :
|
||||
port_wakeup_test_8.cpp
|
||||
;
|
||||
|
||||
SimpleTest port_wakeup_test_9 :
|
||||
port_wakeup_test_9.cpp
|
||||
;
|
||||
|
||||
SimpleTest transfer_area_test :
|
||||
transfer_area_test.cpp
|
||||
;
|
||||
|
||||
SimpleTest syscall_time :
|
||||
syscall_time.cpp
|
||||
;
|
||||
|
||||
SimpleTest yield_test :
|
||||
yield_test.cpp
|
||||
;
|
||||
SimpleTest yield_test : yield_test.cpp ;
|
||||
|
||||
SimpleTest lock_node_test :
|
||||
lock_node_test.cpp
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2002, Manuel J. Petit. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <image.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static void
|
||||
usage(char const *app)
|
||||
{
|
||||
printf("usage: %s [-s] ###\n", app);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
bool silent = false;
|
||||
int num = 0;
|
||||
int result;
|
||||
|
||||
switch (argc) {
|
||||
case 2:
|
||||
num = atoi(argv[1]);
|
||||
break;
|
||||
case 3:
|
||||
if (!strcmp(argv[1], "-s")) {
|
||||
num = atoi(argv[2]);
|
||||
silent = true;
|
||||
break;
|
||||
}
|
||||
// supposed to fall through
|
||||
|
||||
default:
|
||||
usage(argv[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
if (num < 2) {
|
||||
result = 1;
|
||||
} else {
|
||||
char buffer[64];
|
||||
char* args[]= { argv[0], "-s", buffer, NULL };
|
||||
int argCount = 3;
|
||||
status_t status;
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "%d", num - 1);
|
||||
thread_id threadA = load_image(argCount, (const char**)args, (const char**)environ);
|
||||
snprintf(buffer, sizeof(buffer), "%d", num - 2);
|
||||
thread_id threadB = load_image(argCount, (const char**)args, (const char**)environ);
|
||||
|
||||
resume_thread(threadA);
|
||||
resume_thread(threadB);
|
||||
|
||||
while (wait_for_thread(threadA, &status) == B_INTERRUPTED)
|
||||
;
|
||||
result = status;
|
||||
|
||||
while (wait_for_thread(threadB, &status) == B_INTERRUPTED)
|
||||
;
|
||||
result += status;
|
||||
}
|
||||
|
||||
if (silent) {
|
||||
return result;
|
||||
} else {
|
||||
printf("%d\n", result);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue