Skip to content

Commit

Permalink
[test] electron lse/lsi/hse refactored to enforce an intended configu…
Browse files Browse the repository at this point in the history
…ration
  • Loading branch information
avtolstoy committed Oct 5, 2021
1 parent 849ce44 commit d33b4a3
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 6 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
suite('Electron enable external RTC clock (LSE)');

platform('electron');
systemThread('enabled');

let device = null;

before(function() {
device = this.particle.devices[0];
});

test('01_connect_set_feature_reset', async function() {
await device.reset();
});

test('02_validate', async function() {
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "application.h"
#include "test.h"
#include "test_config.h"

#ifndef PARTICLE_TEST_RUNNER
#error "This test requires to be run under device-os-test"
Expand All @@ -26,6 +27,10 @@
#define TEST_ELECTRON_USE_HSE_LSI (1)
#endif // TEST_ELECTRON_USE_HSE_LSI

#ifndef TEST_ELECTRON_VALIDATE_USES_HSE_LSI
#define TEST_ELECTRON_VALIDATE_USES_HSE_LSI (0)
#endif // TEST_ELECTRON_VALIDATE_USES_HSE_LSI

namespace {

retained time_t sRtcTime = 0;
Expand All @@ -38,7 +43,9 @@ test(01_connect_set_feature_reset) {
System.enableFeature(FEATURE_DISABLE_EXTERNAL_LOW_SPEED_CLOCK);
assertTrue(System.featureEnabled(FEATURE_DISABLE_EXTERNAL_LOW_SPEED_CLOCK));
} else {
assertEqual((RCC->BDCR & 0x300), (RCC_RTCCLKSource_HSE_Div2 & 0x300));
if (TEST_ELECTRON_VALIDATE_USES_HSE_LSI) {
assertEqual((RCC->BDCR & 0x300), (RCC_RTCCLKSource_HSE_Div2 & 0x300));
}
System.disableFeature(FEATURE_DISABLE_EXTERNAL_LOW_SPEED_CLOCK);
assertFalse(System.featureEnabled(FEATURE_DISABLE_EXTERNAL_LOW_SPEED_CLOCK));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

#define TEST_ELECTRON_USE_HSE_LSI (1)
3 changes: 3 additions & 0 deletions user/tests/wiring/electron_rtc_clock_source/test_config_lse.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

#define TEST_ELECTRON_USE_HSE_LSI (0)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#pragma once

#define TEST_ELECTRON_USE_HSE_LSI (0)
#define TEST_ELECTRON_VALIDATE_USES_HSE_LSI (1)

0 comments on commit d33b4a3

Please sign in to comment.