Configurable set_rtc values in RTC test

Fixes #3450
This commit is contained in:
Christian Helmuth 2019-08-14 09:12:12 +02:00
parent 9cf5da85ef
commit d01cc3bf41
2 changed files with 10 additions and 9 deletions

View File

@ -2,6 +2,7 @@
assert_spec x86 assert_spec x86
# RTC setting tested on Qemu only
set test_update [have_include power_on/qemu] set test_update [have_include power_on/qemu]
set build_components { core init drivers/rtc timer test/rtc } set build_components { core init drivers/rtc timer test/rtc }
@ -59,7 +60,7 @@ append config {
<start name="test-rtc" priority="-1"> <start name="test-rtc" priority="-1">
<resource name="RAM" quantum="1M"/>} <resource name="RAM" quantum="1M"/>}
append_if $test_update config { append_if $test_update config {
<config set_rtc="yes"/>} <config set_rtc="yes" year="2069" month="12" day="31" hour="23" minute="55" second="0"/>}
append config { append config {
</start> </start>
</config>} </config>}

View File

@ -57,7 +57,7 @@ struct Main
Constructible<Reporter> _reporter { }; Constructible<Reporter> _reporter { };
void _test_update() void _test_update(Xml_node const &config)
{ {
try { try {
_reporter.construct(_env, "set_rtc"); _reporter.construct(_env, "set_rtc");
@ -66,12 +66,12 @@ struct Main
rtc1.set_sigh(_set_sigh); rtc1.set_sigh(_set_sigh);
Rtc::Timestamp ts = rtc1.current_time(); Rtc::Timestamp ts = rtc1.current_time();
ts.year = 2069; ts.year = config.attribute_value("year", 2069U);
ts.month = 12; ts.month = config.attribute_value("month", 12U);
ts.day = 31; ts.day = config.attribute_value("day", 31U);
ts.hour = 23; ts.hour = config.attribute_value("hour", 23U);
ts.minute = 55; ts.minute = config.attribute_value("minute", 58U);
ts.second = 0; ts.second = config.attribute_value("second", 0U);
_ts = ts; _ts = ts;
@ -116,7 +116,7 @@ struct Main
Attached_rom_dataspace config_rom { env, "config" }; Attached_rom_dataspace config_rom { env, "config" };
bool const test_update = config_rom.xml().attribute_value("set_rtc", false); bool const test_update = config_rom.xml().attribute_value("set_rtc", false);
if (test_update) { if (test_update) {
_test_update(); _test_update(config_rom.xml());
return; return;
} }