mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Test fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17011 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
dbc0d1ea68
commit
2fbdef5e25
5 changed files with 28 additions and 50 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-06-23 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Testing/diningPhilosophers.m: Locking and output fixes (from
|
||||
Chris Beaham).
|
||||
* Testing/create-abbrevs, Testing/create-regions: Remove.
|
||||
|
||||
2003-06-23 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/NSProcessInfo.m (+load): use the KVM library where
|
||||
|
|
|
@ -32,26 +32,19 @@ include ../Version
|
|||
include ../config.mak
|
||||
|
||||
# The tools to be compiled
|
||||
TEST_TOOL_NAME = \
|
||||
CHECKABLE_TOOLS = \
|
||||
awake \
|
||||
basic \
|
||||
benchmark \
|
||||
call \
|
||||
containers \
|
||||
create-abbrevs \
|
||||
create-regions \
|
||||
diningPhilosophers \
|
||||
fref \
|
||||
gstcpport-client \
|
||||
gstcpport-server \
|
||||
nsarchiver \
|
||||
nsarray \
|
||||
nsattributedstring \
|
||||
nsbundle \
|
||||
nscharacterset \
|
||||
nsconnection \
|
||||
nsconnection_client \
|
||||
nsconnection_server \
|
||||
nsdata \
|
||||
nsdate \
|
||||
nsdictionary \
|
||||
|
@ -74,6 +67,12 @@ TEST_TOOL_NAME = \
|
|||
thread-except \
|
||||
values \
|
||||
|
||||
TEST_TOOL_NAME = $(CHECKABLE_TOOLS) \
|
||||
diningPhilosophers \
|
||||
gstcpport-client \
|
||||
gstcpport-server \
|
||||
nsconnection_client \
|
||||
nsconnection_server \
|
||||
|
||||
# The tool Objective-C source files to be compiled
|
||||
awake_OBJC_FILES = awake.m
|
||||
|
@ -81,8 +80,6 @@ basic_OBJC_FILES = basic.m
|
|||
benchmark_OBJC_FILES = benchmark.m
|
||||
call_OBJC_FILES = call.m
|
||||
containers_OBJC_FILES = containers.m
|
||||
create-abbrevs_OBJC_FILES = create-abbrevs.m
|
||||
create-regions_OBJC_FILES = create-regions.m
|
||||
diningPhilosophers_OBJC_FILES = diningPhilosophers.m
|
||||
fref_OBJC_FILES = fref.m
|
||||
gstcpport-client_OBJC_FILES = gstcpport-client.m
|
||||
|
|
|
@ -35,42 +35,6 @@
|
|||
# otherwise the normal makefile rules will not be performed.
|
||||
#
|
||||
|
||||
CHECKABLE_TOOLS = \
|
||||
awake \
|
||||
basic \
|
||||
benchmark \
|
||||
call \
|
||||
containers \
|
||||
create-abbrevs \
|
||||
create-regions \
|
||||
fref \
|
||||
nsarchiver \
|
||||
nsarray \
|
||||
nsattributedstring \
|
||||
nsbundle \
|
||||
nscharacterset \
|
||||
nsconnection \
|
||||
nsdata \
|
||||
nsdate \
|
||||
nsdictionary \
|
||||
nsfilehandle \
|
||||
nsfilemanager \
|
||||
nshashtable \
|
||||
nshost \
|
||||
nsinvocation \
|
||||
nsmaptable \
|
||||
nsnotification \
|
||||
nsprocessinfo \
|
||||
nsscanner \
|
||||
nsset \
|
||||
nstask \
|
||||
nstimezone \
|
||||
release \
|
||||
string \
|
||||
thread \
|
||||
thread-except \
|
||||
values
|
||||
|
||||
# Things to do before compiling
|
||||
# before-all::
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
// NSLocks ... umm I mean forks
|
||||
id forks[5];
|
||||
id fork_lock;
|
||||
|
||||
//
|
||||
// A class of hungry philosophers
|
||||
|
@ -69,23 +70,28 @@ id forks[5];
|
|||
// Its a constant battle to feed yourself
|
||||
while (1)
|
||||
{
|
||||
|
||||
[fork_lock lockWhenCondition:FOOD_SERVED];
|
||||
|
||||
// Get the fork to our left
|
||||
[forks[chair] lockWhenCondition:FOOD_SERVED];
|
||||
|
||||
// Get the fork to our right
|
||||
[forks[(chair + 1) % 5] lockWhenCondition:FOOD_SERVED];
|
||||
|
||||
[fork_lock unlock];
|
||||
|
||||
// Start eating!
|
||||
printf("Philosopher %d can start eating.\n", chair);
|
||||
printf("Philosopher %d can start eating.\n", chair); fflush(stdout);
|
||||
|
||||
for (i = 0;i < 100000; ++i)
|
||||
{
|
||||
if ((i % 10000) == 0)
|
||||
printf("Philosopher %d is eating.\n", chair);
|
||||
printf("Philosopher %d is eating.\n", chair); fflush(stdout);
|
||||
}
|
||||
|
||||
// Done eating
|
||||
printf("Philosopher %d is done eating.\n", chair);
|
||||
printf("Philosopher %d is done eating.\n", chair); fflush(stdout);
|
||||
|
||||
// Drop the fork to our left
|
||||
[forks[chair] unlock];
|
||||
|
@ -125,6 +131,10 @@ int main()
|
|||
[forks[i] lock];
|
||||
}
|
||||
|
||||
fork_lock = [[NSConditionLock alloc]
|
||||
initWithCondition:NO_FOOD];
|
||||
[fork_lock lock];
|
||||
|
||||
// Create the philosophers
|
||||
for (i = 0;i < 5; ++i)
|
||||
p[i] = [[Philosopher alloc] init];
|
||||
|
@ -135,6 +145,7 @@ int main()
|
|||
toTarget:p[i] withObject: [NSNumber numberWithInt: i]];
|
||||
|
||||
// Now let them all eat
|
||||
[fork_lock unlockWithCondition:FOOD_SERVED];
|
||||
for (i = 0;i < 5; ++i)
|
||||
[forks[i] unlockWithCondition:FOOD_SERVED];
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
@interface XX : NSObject
|
||||
- (void) fire;
|
||||
|
|
Loading…
Reference in a new issue