1 | /* $Id: tstRTFsQueries.cpp 2981 2007-06-01 16:01:28Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * innotek Portable Runtime Testcase - RTFs Queries..
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*******************************************************************************
|
---|
23 | * Header Files *
|
---|
24 | *******************************************************************************/
|
---|
25 | #include <iprt/path.h>
|
---|
26 | #include <iprt/runtime.h>
|
---|
27 | #include <iprt/stream.h>
|
---|
28 | #include <iprt/err.h>
|
---|
29 |
|
---|
30 |
|
---|
31 | int main(int argc, char **argv)
|
---|
32 | {
|
---|
33 | RTR3Init();
|
---|
34 |
|
---|
35 | /*
|
---|
36 | * Process all arguments (including the executable).
|
---|
37 | */
|
---|
38 | int cErrors = 0;
|
---|
39 | for (int i = 0; i < argc; i++)
|
---|
40 | {
|
---|
41 | RTPrintf("tstRTFsQueries: '%s'...\n", argv[i]);
|
---|
42 |
|
---|
43 | uint32_t u32Serial;
|
---|
44 | int rc = RTFsQuerySerial(argv[i], &u32Serial);
|
---|
45 | if (RT_SUCCESS(rc))
|
---|
46 | RTPrintf("tstRTFsQueries: u32Serial=%#010RX32\n", u32Serial);
|
---|
47 | else
|
---|
48 | {
|
---|
49 | RTPrintf("tstRTFsQueries: RTFsQuerySerial failed, rc=%Vrc\n", rc);
|
---|
50 | cErrors++;
|
---|
51 | }
|
---|
52 |
|
---|
53 | RTFOFF cbTotal = 42;
|
---|
54 | RTFOFF cbFree = 42;
|
---|
55 | uint32_t cbBlock = 42;
|
---|
56 | uint32_t cbSector = 42;
|
---|
57 | rc = RTFsQuerySizes(argv[i], &cbTotal, &cbFree, &cbBlock, &cbSector);
|
---|
58 | if (RT_SUCCESS(rc))
|
---|
59 | RTPrintf("tstRTFsQueries: cbTotal=%RTfoff cbFree=%RTfoff cbBlock=%d cbSector=%d\n",
|
---|
60 | cbTotal, cbFree, cbBlock, cbSector);
|
---|
61 | else
|
---|
62 | {
|
---|
63 | RTPrintf("tstRTFsQueries: RTFsQuerySerial failed, rc=%Vrc\n", rc);
|
---|
64 | cErrors++;
|
---|
65 | }
|
---|
66 |
|
---|
67 | rc = RTFsQuerySizes(argv[i], NULL, NULL, NULL, NULL);
|
---|
68 | if (RT_FAILURE(rc))
|
---|
69 | {
|
---|
70 | RTPrintf("tstRTFsQueries: RTFsQuerySizes(nop) failed, rc=%Vrc\n", rc);
|
---|
71 | cErrors++;
|
---|
72 | }
|
---|
73 |
|
---|
74 | RTFSPROPERTIES Props;
|
---|
75 | rc = RTFsQueryProperties(argv[i], &Props);
|
---|
76 | if (RT_SUCCESS(rc))
|
---|
77 | RTPrintf("tstRTFsQueries: cbMaxComponent=%u %s %s %s %s %s %s\n",
|
---|
78 | Props.cbMaxComponent,
|
---|
79 | Props.fCaseSensitive ? "case" : "not-case",
|
---|
80 | Props.fCompressed ? "compressed" : "not-compressed",
|
---|
81 | Props.fFileCompression ? "file-compression" : "no-file-compression",
|
---|
82 | Props.fReadOnly ? "readonly" : "readwrite",
|
---|
83 | Props.fRemote ? "remote" : "not-remote",
|
---|
84 | Props.fSupportsUnicode ? "supports-unicode" : "doesn't-support-unicode");
|
---|
85 | else
|
---|
86 | {
|
---|
87 | RTPrintf("tstRTFsQueries: RTFsQueryProperties failed, rc=%Vrc\n", rc);
|
---|
88 | cErrors++;
|
---|
89 | }
|
---|
90 | }
|
---|
91 |
|
---|
92 | if (!cErrors)
|
---|
93 | RTPrintf("tstRTFsQueries: SUCCESS\n");
|
---|
94 | else
|
---|
95 | RTPrintf("tstRTFsQueries: FAIlURE - %u errors\n", cErrors);
|
---|
96 | return !!cErrors;
|
---|
97 | }
|
---|