1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is the Netscape Portable Runtime (NSPR).
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998-2000
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
40 ** Description: testing the DCE emulation api
42 ** Modification History:
43 ** 14-May-97 AGarcia- Converted the test to accomodate the debug_mode flag.
44 ** The debug mode will print all of the printfs associated with this test.
45 ** The regress mode will be the default mode. Since the regress tool limits
46 ** the output to a one line status:PASS or FAIL,all of the printf statements
47 ** have been handled with an if (debug_mode) statement.
48 ** 04-June-97 AGarcia removed the Test_Result function. Regress tool has been updated to
49 ** recognize the return code from tha main program.
50 ** 12-June-97 Revert to return code 0 and 1, remove debug option (obsolete).
53 /***********************************************************************
55 ***********************************************************************/
58 #if defined(_PR_DCETHREADS)
66 PRIntn failed_already
=0;
69 static PRIntn
prmain(PRIntn argc
, char **argv
)
72 PRLock
*ml
= PR_NewLock();
73 PRCondVar
*cv
= PRP_NewNakedCondVar();
74 PRIntervalTime tenmsecs
= PR_MillisecondsToInterval(10);
77 PR_ASSERT(PR_SUCCESS
== rv
);
78 if ((rv
!= PR_SUCCESS
) & (!debug_mode
)) failed_already
=1;
81 PR_ASSERT(PR_FAILURE
== rv
);
82 if ((rv
!= PR_FAILURE
) & (!debug_mode
)) failed_already
=1;
84 rv
= PRP_NakedNotify(cv
);
85 PR_ASSERT(PR_SUCCESS
== rv
);
86 if ((rv
!= PR_SUCCESS
) & (!debug_mode
)) failed_already
=1;
88 rv
= PRP_NakedBroadcast(cv
);
89 PR_ASSERT(PR_SUCCESS
== rv
);
90 if ((rv
!= PR_SUCCESS
) & (!debug_mode
)) failed_already
=1;
92 rv
= PRP_NakedWait(cv
, ml
, tenmsecs
);
93 PR_ASSERT(PR_SUCCESS
== rv
);
94 if ((rv
!= PR_SUCCESS
) & (!debug_mode
)) failed_already
=1;
98 rv
= PRP_NakedNotify(cv
);
99 PR_ASSERT(PR_SUCCESS
== rv
);
100 if ((rv
!= PR_SUCCESS
) & (!debug_mode
)) failed_already
=1;
102 rv
= PRP_NakedBroadcast(cv
);
103 PR_ASSERT(PR_SUCCESS
== rv
);
104 if ((rv
!= PR_SUCCESS
) & (!debug_mode
)) failed_already
=1;
106 PRP_DestroyNakedCondVar(cv
);
109 if (debug_mode
) printf("Test succeeded\n");
115 #endif /* #if defined(_PR_DCETHREADS) */
117 int main(int argc
, char **argv
)
120 #if defined(_PR_DCETHREADS)
121 PR_Initialize(prmain
, argc
, argv
, 0);