mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-10 17:36:11 +00:00
lib: Allow users of env_set() to specify a default value
So when the environment value isn't set, one can specify the default value to return. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
This commit is contained in:
parent
94444aea6e
commit
aefc5c63e4
@ -689,13 +689,13 @@ bool drmtest_only_list_subtests(void)
|
|||||||
return list_subtests;
|
return list_subtests;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool env_set(const char *env_var)
|
static bool env_set(const char *env_var, bool default_value)
|
||||||
{
|
{
|
||||||
char *val;
|
char *val;
|
||||||
|
|
||||||
val = getenv(env_var);
|
val = getenv(env_var);
|
||||||
if (!val)
|
if (!val)
|
||||||
return false;
|
return default_value;
|
||||||
|
|
||||||
return atoi(val) != 0;
|
return atoi(val) != 0;
|
||||||
}
|
}
|
||||||
@ -705,7 +705,7 @@ bool drmtest_run_in_simulation(void)
|
|||||||
static int simulation = -1;
|
static int simulation = -1;
|
||||||
|
|
||||||
if (simulation == -1)
|
if (simulation == -1)
|
||||||
simulation = env_set("INTEL_SIMULATION");
|
simulation = env_set("INTEL_SIMULATION", false);
|
||||||
|
|
||||||
return simulation;
|
return simulation;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user