1 | /* $Id: tstRTFsQueries.cpp 4071 2007-08-07 17:07:59Z 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 |
|
---|
18 | /*******************************************************************************
|
---|
19 | * Header Files *
|
---|
20 | *******************************************************************************/
|
---|
21 | #include <iprt/path.h>
|
---|
22 | #include <iprt/runtime.h>
|
---|
23 | #include <iprt/stream.h>
|
---|
24 | #include <iprt/err.h>
|
---|
25 |
|
---|
26 |
|
---|
27 | int main(int argc, char **argv)
|
---|
28 | {
|
---|
29 | RTR3Init();
|
---|
30 |
|
---|
31 | /*
|
---|
32 | * Process all arguments (including the executable).
|
---|
33 | */
|
---|
34 | int cErrors = 0;
|
---|
35 | for (int i = 0; i < argc; i++)
|
---|
36 | {
|
---|
37 | RTPrintf("tstRTFsQueries: '%s'...\n", argv[i]);
|
---|
38 |
|
---|
39 | uint32_t u32Serial;
|
---|
40 | int rc = RTFsQuerySerial(argv[i], &u32Serial);
|
---|
41 | if (RT_SUCCESS(rc))
|
---|
42 | RTPrintf("tstRTFsQueries: u32Serial=%#010RX32\n", u32Serial);
|
---|
43 | else
|
---|
44 | {
|
---|
45 | RTPrintf("tstRTFsQueries: RTFsQuerySerial failed, rc=%Vrc\n", rc);
|
---|
46 | cErrors++;
|
---|
47 | }
|
---|
48 |
|
---|
49 | RTFOFF cbTotal = 42;
|
---|
50 | RTFOFF cbFree = 42;
|
---|
51 | uint32_t cbBlock = 42;
|
---|
52 | uint32_t cbSector = 42;
|
---|
53 | rc = RTFsQuerySizes(argv[i], &cbTotal, &cbFree, &cbBlock, &cbSector);
|
---|
54 | if (RT_SUCCESS(rc))
|
---|
55 | RTPrintf("tstRTFsQueries: cbTotal=%RTfoff cbFree=%RTfoff cbBlock=%d cbSector=%d\n",
|
---|
56 | cbTotal, cbFree, cbBlock, cbSector);
|
---|
57 | else
|
---|
58 | {
|
---|
59 | RTPrintf("tstRTFsQueries: RTFsQuerySerial failed, rc=%Vrc\n", rc);
|
---|
60 | cErrors++;
|
---|
61 | }
|
---|
62 |
|
---|
63 | rc = RTFsQuerySizes(argv[i], NULL, NULL, NULL, NULL);
|
---|
64 | if (RT_FAILURE(rc))
|
---|
65 | {
|
---|
66 | RTPrintf("tstRTFsQueries: RTFsQuerySizes(nop) failed, rc=%Vrc\n", rc);
|
---|
67 | cErrors++;
|
---|
68 | }
|
---|
69 |
|
---|
70 | RTFSPROPERTIES Props;
|
---|
71 | rc = RTFsQueryProperties(argv[i], &Props);
|
---|
72 | if (RT_SUCCESS(rc))
|
---|
73 | RTPrintf("tstRTFsQueries: cbMaxComponent=%u %s %s %s %s %s %s\n",
|
---|
74 | Props.cbMaxComponent,
|
---|
75 | Props.fCaseSensitive ? "case" : "not-case",
|
---|
76 | Props.fCompressed ? "compressed" : "not-compressed",
|
---|
77 | Props.fFileCompression ? "file-compression" : "no-file-compression",
|
---|
78 | Props.fReadOnly ? "readonly" : "readwrite",
|
---|
79 | Props.fRemote ? "remote" : "not-remote",
|
---|
80 | Props.fSupportsUnicode ? "supports-unicode" : "doesn't-support-unicode");
|
---|
81 | else
|
---|
82 | {
|
---|
83 | RTPrintf("tstRTFsQueries: RTFsQueryProperties failed, rc=%Vrc\n", rc);
|
---|
84 | cErrors++;
|
---|
85 | }
|
---|
86 | }
|
---|
87 |
|
---|
88 | if (!cErrors)
|
---|
89 | RTPrintf("tstRTFsQueries: SUCCESS\n");
|
---|
90 | else
|
---|
91 | RTPrintf("tstRTFsQueries: FAIlURE - %u errors\n", cErrors);
|
---|
92 | return !!cErrors;
|
---|
93 | }
|
---|