Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
aom-rav1e
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
aom-rav1e
Commits
ab9160de
Commit
ab9160de
authored
11 years ago
by
Joshua Litt
Browse files
Options
Downloads
Patches
Plain Diff
Allow test data path to be set by preprocessor symbol
Change-Id: I19c482c7cba34db574b3f33178ba20aede49779e
parent
103c4603
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/video_source.h
+27
-8
27 additions, 8 deletions
test/video_source.h
with
27 additions
and
8 deletions
test/video_source.h
+
27
−
8
View file @
ab9160de
...
...
@@ -18,16 +18,35 @@
namespace
libvpx_test
{
static
FILE
*
OpenTestDataFile
(
const
std
::
string
&
file_name
)
{
std
::
string
path_to_source
=
file_name
;
const
char
*
kDataPath
=
getenv
(
"LIBVPX_TEST_DATA_PATH"
);
if
(
kDataPath
)
{
path_to_source
=
kDataPath
;
path_to_source
+=
"/"
;
path_to_source
+=
file_name
;
// Helper macros to ensure LIBVPX_TEST_DATA_PATH is a quoted string.
// These are undefined right below GetDataPath
// NOTE: LIBVPX_TEST_DATA_PATH MUST NOT be a quoted string before
// Stringification or the GetDataPath will fail at runtime
#define TO_STRING(S) #S
#define STRINGIFY(S) TO_STRING(S)
// A simple function to encapsulate cross platform retrieval of test data path
static
std
::
string
GetDataPath
()
{
const
char
*
const
data_path
=
getenv
(
"LIBVPX_TEST_DATA_PATH"
);
if
(
data_path
==
NULL
)
{
#ifdef LIBVPX_TEST_DATA_PATH
// In some environments, we cannot set environment variables
// Instead, we set the data path by using a preprocessor symbol
// which can be set from make files
return
STRINGIFY
(
LIBVPX_TEST_DATA_PATH
);
#else
return
"."
;
#endif
}
return
data_path
;
}
// Undefining stringification macros because they are not used elsewhere
#undef TO_STRING
#undef STRINGIFY
static
FILE
*
OpenTestDataFile
(
const
std
::
string
&
file_name
)
{
const
std
::
string
path_to_source
=
GetDataPath
()
+
"/"
+
file_name
;
return
fopen
(
path_to_source
.
c_str
(),
"rb"
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment