1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/nsprpub/pr/tests/reinit.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* This test verifies that NSPR can be cleaned up and reinitialized. */ 1.10 + 1.11 +#include "nspr.h" 1.12 +#include <stdio.h> 1.13 + 1.14 +int main() 1.15 +{ 1.16 + PRStatus rv; 1.17 + 1.18 + fprintf(stderr, "Init 1\n"); 1.19 + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); 1.20 + fprintf(stderr, "Cleanup 1\n"); 1.21 + rv = PR_Cleanup(); 1.22 + if (rv != PR_SUCCESS) { 1.23 + fprintf(stderr, "FAIL\n"); 1.24 + return 1; 1.25 + } 1.26 + 1.27 + fprintf(stderr, "Init 2\n"); 1.28 + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); 1.29 + fprintf(stderr, "Cleanup 2\n"); 1.30 + rv = PR_Cleanup(); 1.31 + if (rv != PR_SUCCESS) { 1.32 + fprintf(stderr, "FAIL\n"); 1.33 + return 1; 1.34 + } 1.35 + 1.36 + fprintf(stderr, "PASS\n"); 1.37 + return 0; 1.38 +}