tests: Add lib/timestamp-test test case
Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I39abfc644fef085cef2175086a0e45a040b244de Reviewed-on: https://review.coreboot.org/c/coreboot/+/46968 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
This commit is contained in:
committed by
Patrick Georgi
parent
5742357e4d
commit
e0c60f3d39
29
tests/stubs/timestamp.c
Normal file
29
tests/stubs/timestamp.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include "stubs/timestamp.h"
|
||||
|
||||
static uint64_t timestamp_value = 0;
|
||||
static int timestamp_tick_freq_mhz_value = 1;
|
||||
|
||||
/* Provides way to control timestamp value */
|
||||
void dummy_timestamp_set(uint64_t v)
|
||||
{
|
||||
timestamp_value = v;
|
||||
}
|
||||
|
||||
/* Provides way to control timestamp tick frequency MHz value */
|
||||
void dummy_timestamp_tick_freq_mhz_set(int v)
|
||||
{
|
||||
timestamp_tick_freq_mhz_value = v;
|
||||
}
|
||||
|
||||
/* Reimplementation of timestamp getter to control behaviour */
|
||||
uint64_t timestamp_get(void)
|
||||
{
|
||||
return timestamp_value;
|
||||
}
|
||||
|
||||
int timestamp_tick_freq_mhz(void)
|
||||
{
|
||||
return timestamp_tick_freq_mhz_value;
|
||||
}
|
Reference in New Issue
Block a user