Changeset 26604 in vbox
- Timestamp:
- Feb 17, 2010 12:32:58 PM (15 years ago)
- Location:
- trunk/src/VBox/Runtime/testcase
- Files:
-
- 2 edited
-
Makefile.kmk (modified) (1 diff)
-
tstSystemQueryOsInfo.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/Makefile.kmk
r26525 r26604 408 408 tstRTStrVersion_SOURCES = tstRTStrVersion.cpp 409 409 410 tstSystemQueryOsInfo_TEMPLATE = VBOXR3TSTEXE 410 411 tstSystemQueryOsInfo_SOURCES = tstSystemQueryOsInfo.cpp 411 412 -
trunk/src/VBox/Runtime/testcase/tstSystemQueryOsInfo.cpp
r26344 r26604 33 33 *******************************************************************************/ 34 34 #include <iprt/system.h> 35 #include <iprt/initterm.h>36 35 #include <iprt/string.h> 37 #include <iprt/ stream.h>36 #include <iprt/test.h> 38 37 39 38 … … 46 45 int main() 47 46 { 48 RTR3Init(); 49 50 RTPrintf("tstSystemQueryOsInfo: TESTINGS...\n"); 47 RTTEST hTest; 48 int rc = RTTestInitAndCreate("tstRTSystemQueryOsInfo", &hTest); 49 if (rc) 50 return rc; 51 RTTestBanner(hTest); 51 52 52 53 /* … … 54 55 */ 55 56 char szInfo[256]; 56 int rc;57 57 58 58 rc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szInfo, sizeof(szInfo)); 59 RT Printf("tstSystemQueryOsInfo:PRODUCT: \"%s\", rc=%Rrc\n", szInfo, rc);59 RTTestIPrintf(RTTESTLVL_ALWAYS, "PRODUCT: \"%s\", rc=%Rrc\n", szInfo, rc); 60 60 61 61 rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szInfo, sizeof(szInfo)); 62 RT Printf("tstSystemQueryOsInfo:RELEASE: \"%s\", rc=%Rrc\n", szInfo, rc);62 RTTestIPrintf(RTTESTLVL_ALWAYS, "RELEASE: \"%s\", rc=%Rrc\n", szInfo, rc); 63 63 64 64 rc = RTSystemQueryOSInfo(RTSYSOSINFO_VERSION, szInfo, sizeof(szInfo)); 65 RT Printf("tstSystemQueryOsInfo:VERSION: \"%s\", rc=%Rrc\n", szInfo, rc);65 RTTestIPrintf(RTTESTLVL_ALWAYS, "VERSION: \"%s\", rc=%Rrc\n", szInfo, rc); 66 66 67 67 rc = RTSystemQueryOSInfo(RTSYSOSINFO_SERVICE_PACK, szInfo, sizeof(szInfo)); 68 RT Printf("tstSystemQueryOsInfo:SERVICE_PACK: \"%s\", rc=%Rrc\n", szInfo, rc);68 RTTestIPrintf(RTTESTLVL_ALWAYS, "SERVICE_PACK: \"%s\", rc=%Rrc\n", szInfo, rc); 69 69 70 70 /* … … 77 77 if ( rc == VERR_NOT_SUPPORTED 78 78 && szInfo[0] != '\0') 79 { 80 RTPrintf("tstSystemQueryOsInfo: FAILED - level=%d, rc=VERR_NOT_SUPPORTED, buffer not terminated\n", i); 81 g_cErrors++; 82 } 79 RTTestIFailed("level=%d; unterminated buffer on VERR_NOT_SUPPORTED\n", i); 80 else if (RT_SUCCESS(rc) || rc == VERR_BUFFER_OVERFLOW) 81 RTTESTI_CHECK(memchr(szInfo, '\0', sizeof(szInfo)) != NULL); 82 else if (rc != VERR_NOT_SUPPORTED) 83 RTTestIFailed("level=%d unexpected rc=%Rrc\n", i, rc); 83 84 } 84 85 … … 98 99 if (szInfo[off] != 0x7f) 99 100 { 100 RTPrintf("tstSystemQueryOsInfo: FAILED - level=%d, rc=%Rrc, cch=%zu, off=%zu: Wrote too much!\n", i, rc, cch, off); 101 g_cErrors++; 101 RTTestIFailed("level=%d, rc=%Rrc, cch=%zu, off=%zu: Wrote too much!\n", i, rc, cch, off); 102 102 break; 103 103 } … … 111 111 { 112 112 113 RT Printf("tstSystemQueryOsInfo: FAILED -level=%d, rc=%Rrc, cch=%zu: Buffer not terminated!\n", i, rc, cch);113 RTTestIFailed("level=%d, rc=%Rrc, cch=%zu: Buffer not terminated!\n", i, rc, cch); 114 114 g_cErrors++; 115 115 } … … 117 117 } 118 118 119 /* 120 * Summarize and exit. 121 */ 122 if (!g_cErrors) 123 RTPrintf("tstSystemQueryOsInfo: SUCCESS\n"); 124 else 125 RTPrintf("tstSystemQueryOsInfo: FAILED - %d errors\n", g_cErrors); 126 return !!g_cErrors; 119 return RTTestSummaryAndDestroy(hTest); 127 120 } 128 121
Note:
See TracChangeset
for help on using the changeset viewer.

