This commit is contained in:
2026-01-19 16:19:41 +01:00
commit edd3e96591
301 changed files with 36763 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import sys
import os
import time
folder_path = os.path.abspath(os.path.join("components", "system_tests"))
if folder_path not in sys.path:
sys.path.append(folder_path)
from scan_serial import ESP32Runner
def test_sdcard_initialize():
runner = ESP32Runner(mode="SIM", port="COM9")
runner.start()
print("--- QEMU Runner Started ---", flush=True)
try:
start_time = time.time()
while time.time() - start_time < 30:
line = runner.get_line(timeout=1.0)
if line:
print(line, flush=True)
if "SD card mounted successfully" in line:
print("SUCCESS CRITERIA MET!", flush=True)
return 0
if runner.process.poll() is not None:
print(f"Process exited with code: {runner.process.returncode}", flush=True)
return 1
finally:
runner.stop()
print("Done.", flush=True)
return 1
if __name__ == "__main__":
exit_code = test_sdcard_initialize()
sys.exit(exit_code)

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<test_scenario>
<!-- The configuration for the test environment. -->
<!-- Available configurations: SIMULATE, HIL -->
<config>SIMULATE</config>
<test_case>
<test_case_id>SDCARD_INIT_TEST</test_case_id>
<!-- The main command that executes the test itself. -->
<test_exec>python components/drivers/SDcard/test/sdcard_init_test.py</test_exec>
</test_case>
</test_scenario>

View File

@@ -0,0 +1,31 @@
/**
* @file test_sdcard.cpp
* @brief Unit tests for SD Card driver component
* @author Mahmoud Elmohtady
* @company Nabd solutions - ASF
* @copyright Copyright (c) 2025
*/
#include "unity.h"
#include "sdcard.hpp"
extern "C" {
void setUp(void)
{
}
void tearDown(void)
{
}
void test_sdcard_mount(void)
{
SdCardDriver sdcard;
bool result = sdcard.mount();
TEST_ASSERT_TRUE(result);
TEST_ASSERT_TRUE(sdcard.isMounted());
}
} // extern "C"