diff options
author | Rafael David Tinoco <rafael.tinoco@linaro.org> | 2019-01-29 15:36:55 -0200 |
---|---|---|
committer | Cyril Hrubis <chrubis@suse.cz> | 2019-01-30 14:22:24 +0100 |
commit | 14e435649d2cd228ed54daf497273740455addf7 (patch) | |
tree | 7fd38938252f36444b5c9db986f21cb50fe13205 /include | |
parent | e744bc9e6396f2c04e4d886bd7076eea9feab4ae (diff) |
lib: new restore_wallclock field to restore realtime clock
Some tests that change the system-wide clock need to have a way to
restore the correct time after their execution.
This commit introduces a new field to tst_test struct called
"restore_wallclock": it makes the test to save current realtime clock
during setup phase, and, later, during cleanup, restore it to the
appropriate time using a monotonic raw clock difference.
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Diffstat (limited to 'include')
-rw-r--r-- | include/tst_test.h | 1 | ||||
-rw-r--r-- | include/tst_wallclock.h | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/include/tst_test.h b/include/tst_test.h index b37890959..12dda2e79 100644 --- a/include/tst_test.h +++ b/include/tst_test.h @@ -135,6 +135,7 @@ struct tst_test { int needs_rofs:1; int child_needs_reinit:1; int needs_devfs:1; + int restore_wallclock:1; /* * If set the test function will be executed for all available * filesystems and the current filesytem type would be set in the diff --git a/include/tst_wallclock.h b/include/tst_wallclock.h new file mode 100644 index 000000000..7d6723a7a --- /dev/null +++ b/include/tst_wallclock.h @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Rafael David Tinoco <rafael.tinoco@linaro.org> + */ + + +#ifndef TST_WALLCLK_H__ +#define TST_WALLCLK_H__ + +void tst_wallclock_save(void); + +void tst_wallclock_restore(void); + +#endif /* TST_WALLCLK_H__ */ |