10
10
11
11
#include < stdio.h>
12
12
13
- // File utilities for testing purposes.
14
- //
15
- // The ProjectRootPath() method is a convenient way of getting an absolute
16
- // path to the project source tree root directory. Using this, it is easy to
17
- // refer to test resource files in a portable way.
18
- //
19
- // Notice that even if Windows platforms use backslash as path delimiter, it is
20
- // also supported to use slash, so there's no need for #ifdef checks in test
21
- // code for setting up the paths to the resource files.
22
- //
23
- // Example use:
24
- // Assume we have the following code being used in a test source file:
25
- // const std::string kInputFile = webrtc::test::ProjectRootPath() +
26
- // "test/data/voice_engine/audio_long16.wav";
27
- // // Use the kInputFile for the tests...
28
- //
29
- // Then here's some example outputs for different platforms:
30
- // Linux:
31
- // * Source tree located in /home/user/webrtc/trunk
32
- // * Test project located in /home/user/webrtc/trunk/src/testproject
33
- // * Test binary compiled as:
34
- // /home/user/webrtc/trunk/out/Debug/testproject_unittests
35
- // Then ProjectRootPath() will return /home/user/webrtc/trunk/ no matter if
36
- // the test binary is executed from standing in either of:
37
- // /home/user/webrtc/trunk
38
- // or
39
- // /home/user/webrtc/trunk/out/Debug
40
- // (or any other directory below the trunk for that matter).
41
- //
42
- // Windows:
43
- // * Source tree located in C:\Users\user\webrtc\trunk
44
- // * Test project located in C:\Users\user\webrtc\trunk\src\testproject
45
- // * Test binary compiled as:
46
- // C:\Users\user\webrtc\trunk\src\testproject\Debug\testproject_unittests.exe
47
- // Then ProjectRootPath() will return C:\Users\user\webrtc\trunk\ when the
48
- // test binary is executed from inside Visual Studio.
49
- // It will also return the same path if the test is executed from a command
50
- // prompt standing in C:\Users\user\webrtc\trunk\src\testproject\Debug
51
- //
52
- // Mac:
53
- // * Source tree located in /Users/user/webrtc/trunk
54
- // * Test project located in /Users/user/webrtc/trunk/src/testproject
55
- // * Test binary compiled as:
56
- // /Users/user/webrtc/trunk/xcodebuild/Debug/testproject_unittests
57
- // Then ProjectRootPath() will return /Users/user/webrtc/trunk/ no matter if
58
- // the test binary is executed from standing in either of:
59
- // /Users/user/webrtc/trunk
60
- // or
61
- // /Users/user/webrtc/trunk/out/Debug
62
- // (or any other directory below the trunk for that matter).
63
-
64
13
#ifndef WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_
65
14
#define WEBRTC_TEST_TESTSUPPORT_FILEUTILS_H_
66
15
@@ -73,32 +22,14 @@ namespace test {
73
22
// to find the project root.
74
23
extern const char * kCannotFindProjectRootDir ;
75
24
76
- // Finds the root dir of the project, to be able to set correct paths to
77
- // resource files used by tests.
78
- // For desktop, we assume that the project root is two levels above (i.e. the
79
- // current working directory + /../../)
80
- // For Android, it is assumed to be /sdcard/chromium_tests_root/
81
- // For iOS, the resource files are assumed to be included in the test's .app
82
- // bundle.
83
- // If the current working directory is above the project root dir, it will not
84
- // be found.
85
- //
86
- // If symbolic links occur in the path they will be resolved and the actual
87
- // directory will be returned.
88
- //
89
- // Returns the absolute path to the project root dir (usually the trunk dir)
90
- // WITH a trailing path delimiter.
91
- // If the project root is not found, the string specified by
92
- // kCannotFindProjectRootDir is returned.
93
- std::string ProjectRootPath ();
94
-
95
25
// Creates and returns the absolute path to the output directory where log files
96
26
// and other test artifacts should be put. The output directory is generally a
97
27
// directory named "out" at the top-level of the project, i.e. a subfolder to
98
28
// the path returned by ProjectRootPath(). The exception is Android where we use
99
29
// /sdcard/ instead.
100
30
//
101
- // Details described for ProjectRootPath() apply here too.
31
+ // If symbolic links occur in the path they will be resolved and the actual
32
+ // directory will be returned.
102
33
//
103
34
// Returns the path WITH a trailing path delimiter. If the project root is not
104
35
// found, the current working directory ("./") is returned as a fallback.
0 commit comments