diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-11-17 14:43:33 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-11-17 14:43:33 +0100 |
commit | a535cdedfbd280c5e07be1c2445e09973836509a (patch) | |
tree | 22239380a3016c00a09249c9d4c5c0f32bf16055 /lib/intel_os.c | |
parent | aa63fc740c510ed44c1a8dc0fc00f0c92c0581a2 (diff) |
lib/os: Pust igt_require into memory check function
More in line with the usual igt pattern and simplifies the code -
every called just wrapped it in igt_require.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'lib/intel_os.c')
-rw-r--r-- | lib/intel_os.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/lib/intel_os.c b/lib/intel_os.c index c8793b97..c1b88bcc 100644 --- a/lib/intel_os.c +++ b/lib/intel_os.c @@ -193,7 +193,7 @@ intel_get_total_swap_mb(void) } /** - * intel_check_memory: + * intel_require_memory: * @count: number of surfaces that will be created * @size: the size in bytes of each surface * @mode: a bitfield declaring whether the test will be run in RAM or in SWAP @@ -209,11 +209,10 @@ intel_get_total_swap_mb(void) * for their tests. oom-killer tests should only run if this reports that * there is not enough RAM + SWAP! * - * Returns: - * Whether the estimated amount of memory required for the objects - * fits in the available memory on the system. + * If there is not enough RAM this function calls igt_skip with an appropriate + * message. It only ever returns if the requirement is fullfilled. */ -bool intel_check_memory(uint32_t count, uint32_t size, unsigned mode) +void intel_require_memory(uint32_t count, uint32_t size, unsigned mode) { /* rough estimate of how many bytes the kernel requires to track each object */ #define KERNEL_BO_OVERHEAD 512 @@ -235,19 +234,13 @@ bool intel_check_memory(uint32_t count, uint32_t size, unsigned mode) total += intel_get_total_swap_mb(); total *= 1024 * 1024; - if (total <= required) { - igt_log(IGT_LOG_INFO, - "Estimated that we need %llu bytes for the test, but only have %llu bytes available (%s%s)\n", - (long long)required, (long long)total, - mode & (CHECK_RAM | CHECK_SWAP) ? "RAM" : "", - mode & CHECK_SWAP ? " + swap": ""); - return 0; - } - - return 1; + igt_skip_on_f(total <= required, + "Estimated that we need %llu bytes for the test, but only have %llu bytes available (%s%s)\n", + (long long)required, (long long)total, + mode & (CHECK_RAM | CHECK_SWAP) ? "RAM" : "", + mode & CHECK_SWAP ? " + swap": ""); } - void intel_purge_vm_caches(void) { |