2022-06-10 13:35:18 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
/// \file test_hardware.c
|
|
|
|
/// \brief Tests src/liblzma/api/lzma/hardware.h API functions
|
|
|
|
///
|
|
|
|
/// Since the output values of these functions are hardware dependent, these
|
|
|
|
/// tests are trivial. They are simply used to detect errors and machines
|
|
|
|
/// that these function are not supported on.
|
|
|
|
//
|
|
|
|
// Author: Jia Tan
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "tests.h"
|
2022-10-05 13:20:47 +00:00
|
|
|
#include "mythread.h"
|
2022-06-10 13:35:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_lzma_physmem(void)
|
|
|
|
{
|
|
|
|
// NOTE: Use _skip instead of _fail because 0 can also mean that we
|
|
|
|
// don't know how to get this information on this operating system.
|
|
|
|
if (lzma_physmem() == 0)
|
|
|
|
assert_skip("Could not determine amount of physical memory");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
test_lzma_cputhreads(void)
|
|
|
|
{
|
2022-10-05 08:41:38 +00:00
|
|
|
#ifndef MYTHREAD_ENABLED
|
2022-10-05 15:54:12 +00:00
|
|
|
assert_skip("Threading support disabled");
|
2022-10-05 08:41:38 +00:00
|
|
|
#else
|
2022-06-10 13:35:18 +00:00
|
|
|
if (lzma_cputhreads() == 0)
|
|
|
|
assert_skip("Could not determine cpu core count");
|
2022-10-05 08:41:38 +00:00
|
|
|
#endif
|
2022-06-10 13:35:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
tuktest_start(argc, argv);
|
|
|
|
tuktest_run(test_lzma_physmem);
|
|
|
|
tuktest_run(test_lzma_cputhreads);
|
|
|
|
return tuktest_end();
|
|
|
|
}
|