1 krisbash 1.1 /*
2 **==============================================================================
3 **
4 ** Open Management Infrastructure (OMI)
5 **
6 ** Copyright (c) Microsoft Corporation
7 **
8 ** Licensed under the Apache License, Version 2.0 (the "License"); you may not
9 ** use this file except in compliance with the License. You may obtain a copy
10 ** of the License at
11 **
12 ** http://www.apache.org/licenses/LICENSE-2.0
13 **
14 ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16 ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17 ** MERCHANTABLITY OR NON-INFRINGEMENT.
18 **
19 ** See the Apache 2 License for the specific language governing permissions
20 ** and limitations under the License.
21 **
22 krisbash 1.1 **==============================================================================
23 */
24
25 #include "ut.h"
26 #include <base/log.h>
27 #include <base/paths.h>
28 #include <pal/strings.h>
29 #include <pal/sleep.h>
30 #include <iostream>
31
32 using namespace TestSystem;
33
34
35 NitsModuleSetup(OMITestSetup)
36 NitsTrace(PAL_T("OMITestSetup being run"));
37 if(NitsTestGetParam(PAL_T("logstderr")))
38 {
39 Log_OpenStdErr();
40 }
41 else
42 {
43 krisbash 1.1 PAL_Char finalPath[PAL_MAX_PATH_SIZE];
44
45 /* Create name and Open the log file */
46
47 if((CreateLogFileNameWithPrefix("omitest", finalPath) != 0) ||
48 (Log_Open(finalPath) != MI_RESULT_OK))
49 {
50 NitsTrace(PAL_T("failed to open log file; routing output to stderr"));
51 Log_OpenStdErr();
52 }
53 }
54
55 const PAL_Char *loglevelParam = NitsTestGetParam(PAL_T("loglevel"));
56 if(loglevelParam && Log_SetLevelFromPalCharString(loglevelParam) != 0)
57 {
58 NitsTrace(PAL_T("loglevel parameter invalid; not setting loglevel"));
59 NitsAssert(PAL_FALSE, PAL_T("loglevel parameter invalid"));
60 }
61
62 NitsAssert(PAL_TRUE, PAL_T(""));
63 NitsEndModuleSetup
64 krisbash 1.1
65 NitsCleanup(OMITestSetup)
66
67
68 NitsTrace(PAL_T("Cleanup of OMITestSetup being run"));
69 Log_Close();
70
71 #if defined(USE_ALLOCATOR)
72 Sleep_Milliseconds(100);
73 fflush(stdout);
74 std::cout << std::flush;
75 PAL_DumpAllocList();
76 #endif /* defined(USE_ALLOCATOR) */
77
78 NitsAssert(PAL_TRUE, PAL_T(""));
79 NitsEndCleanup
80
|