Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | ** File: dceemu.c |
michael@0 | 8 | ** Description: testing the DCE emulation api |
michael@0 | 9 | ** |
michael@0 | 10 | ** Modification History: |
michael@0 | 11 | ** 14-May-97 AGarcia- Converted the test to accomodate the debug_mode flag. |
michael@0 | 12 | ** The debug mode will print all of the printfs associated with this test. |
michael@0 | 13 | ** The regress mode will be the default mode. Since the regress tool limits |
michael@0 | 14 | ** the output to a one line status:PASS or FAIL,all of the printf statements |
michael@0 | 15 | ** have been handled with an if (debug_mode) statement. |
michael@0 | 16 | ** 04-June-97 AGarcia removed the Test_Result function. Regress tool has been updated to |
michael@0 | 17 | ** recognize the return code from tha main program. |
michael@0 | 18 | ** 12-June-97 Revert to return code 0 and 1, remove debug option (obsolete). |
michael@0 | 19 | **/ |
michael@0 | 20 | |
michael@0 | 21 | /*********************************************************************** |
michael@0 | 22 | ** Includes |
michael@0 | 23 | ***********************************************************************/ |
michael@0 | 24 | |
michael@0 | 25 | #include "prlog.h" |
michael@0 | 26 | #include "prinit.h" |
michael@0 | 27 | #include "prpdce.h" |
michael@0 | 28 | |
michael@0 | 29 | #include <stdio.h> |
michael@0 | 30 | #include <stdlib.h> |
michael@0 | 31 | |
michael@0 | 32 | #if defined(_PR_DCETHREADS) |
michael@0 | 33 | |
michael@0 | 34 | PRIntn failed_already=0; |
michael@0 | 35 | PRIntn debug_mode=0; |
michael@0 | 36 | |
michael@0 | 37 | static PRIntn prmain(PRIntn argc, char **argv) |
michael@0 | 38 | { |
michael@0 | 39 | PRStatus rv; |
michael@0 | 40 | PRLock *ml = PR_NewLock(); |
michael@0 | 41 | PRCondVar *cv = PRP_NewNakedCondVar(); |
michael@0 | 42 | PRIntervalTime tenmsecs = PR_MillisecondsToInterval(10); |
michael@0 | 43 | |
michael@0 | 44 | rv = PRP_TryLock(ml); |
michael@0 | 45 | PR_ASSERT(PR_SUCCESS == rv); |
michael@0 | 46 | if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; |
michael@0 | 47 | |
michael@0 | 48 | rv = PRP_TryLock(ml); |
michael@0 | 49 | PR_ASSERT(PR_FAILURE == rv); |
michael@0 | 50 | if ((rv != PR_FAILURE) & (!debug_mode)) failed_already=1; |
michael@0 | 51 | |
michael@0 | 52 | rv = PRP_NakedNotify(cv); |
michael@0 | 53 | PR_ASSERT(PR_SUCCESS == rv); |
michael@0 | 54 | if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; |
michael@0 | 55 | |
michael@0 | 56 | rv = PRP_NakedBroadcast(cv); |
michael@0 | 57 | PR_ASSERT(PR_SUCCESS == rv); |
michael@0 | 58 | if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; |
michael@0 | 59 | |
michael@0 | 60 | rv = PRP_NakedWait(cv, ml, tenmsecs); |
michael@0 | 61 | PR_ASSERT(PR_SUCCESS == rv); |
michael@0 | 62 | if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; |
michael@0 | 63 | |
michael@0 | 64 | PR_Unlock(ml); |
michael@0 | 65 | |
michael@0 | 66 | rv = PRP_NakedNotify(cv); |
michael@0 | 67 | PR_ASSERT(PR_SUCCESS == rv); |
michael@0 | 68 | if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; |
michael@0 | 69 | |
michael@0 | 70 | rv = PRP_NakedBroadcast(cv); |
michael@0 | 71 | PR_ASSERT(PR_SUCCESS == rv); |
michael@0 | 72 | if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; |
michael@0 | 73 | |
michael@0 | 74 | PRP_DestroyNakedCondVar(cv); |
michael@0 | 75 | PR_DestroyLock(ml); |
michael@0 | 76 | |
michael@0 | 77 | if (debug_mode) printf("Test succeeded\n"); |
michael@0 | 78 | |
michael@0 | 79 | return 0; |
michael@0 | 80 | |
michael@0 | 81 | } /* prmain */ |
michael@0 | 82 | |
michael@0 | 83 | #endif /* #if defined(_PR_DCETHREADS) */ |
michael@0 | 84 | |
michael@0 | 85 | int main(int argc, char **argv) |
michael@0 | 86 | { |
michael@0 | 87 | |
michael@0 | 88 | #if defined(_PR_DCETHREADS) |
michael@0 | 89 | PR_Initialize(prmain, argc, argv, 0); |
michael@0 | 90 | if(failed_already) |
michael@0 | 91 | return 1; |
michael@0 | 92 | else |
michael@0 | 93 | return 0; |
michael@0 | 94 | #else |
michael@0 | 95 | return 0; |
michael@0 | 96 | #endif |
michael@0 | 97 | } /* main */ |
michael@0 | 98 | |
michael@0 | 99 | |
michael@0 | 100 | /* decemu.c */ |