mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
test: add NVS compatible test case and CI job
This commit is contained in:
parent
e45a288516
commit
2e7f6a2247
@ -418,6 +418,38 @@ assign_test:
|
||||
CONFIG_FILE: "$CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/$CI_JOB_NAME.yml"
|
||||
IDF_PATH: "$CI_PROJECT_DIR"
|
||||
|
||||
nvs_compatible_test:
|
||||
<<: *test_template
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- $LOG_PATH
|
||||
- $IDF_PATH/nvs_wifi.bin
|
||||
expire_in: 6 mos
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- NVS_Compatible
|
||||
script:
|
||||
# remove artifacts from last stage (UT logs)
|
||||
- rm -rf $LOG_PATH
|
||||
# add gitlab ssh key
|
||||
- mkdir -p ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
- echo -n $GITLAB_KEY > ~/.ssh/id_rsa_base64
|
||||
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
|
||||
- chmod 600 ~/.ssh/id_rsa
|
||||
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
||||
# clone local test env configs
|
||||
- git clone $TEST_ENV_CONFIG_REPOSITORY
|
||||
# clone test bench
|
||||
- git clone $TEST_SCRIPT_REPOSITORY
|
||||
- cd auto_test_script
|
||||
- git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
|
||||
# prepare nvs bins
|
||||
- ./Tools/prepare_nvs_bin.sh
|
||||
# run test
|
||||
- python CIRunner.py -l "$LOG_PATH/$CI_JOB_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH -m $MODULE_UPDATE_FILE
|
||||
|
||||
UT_001_01:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
|
@ -0,0 +1,11 @@
|
||||
BinPath:
|
||||
path: test_bins/ESP32_IDF/SSC_BLE
|
||||
test app: SSC_BLE
|
||||
|
||||
DUT: [SSC1]
|
||||
|
||||
Filter:
|
||||
- Add:
|
||||
SDK: ESP32_IDF
|
||||
Test App: SSC_BLE
|
||||
summary: 'use old NVS data WIFI function test'
|
@ -8432,4 +8432,35 @@ test cases:
|
||||
2 SSC target connect with PC by UART.'
|
||||
test point 1: interaction
|
||||
test point 2: Scan interact with other WiFi operation
|
||||
version: v1 (2015-8-15)
|
||||
version: v1 (2015-8-15)
|
||||
- ID: SYS_NVS_01001
|
||||
SDK: ESP32_IDF
|
||||
Test App: SSC_BLE
|
||||
auto test: 'Yes'
|
||||
category: Function
|
||||
test point 1: compatiable test
|
||||
test point 2: test if latest SDK work with pervious version of NVS data
|
||||
summary: use old NVS data WIFI function test
|
||||
steps: |
|
||||
1. get NVS data from earlier released branches and last master
|
||||
2. download each NVS data to target
|
||||
3. check if auto connected to the same AP
|
||||
4. check if SoftAP config is correct
|
||||
expected result: |
|
||||
1. succeed
|
||||
2. succeed
|
||||
3. succeed
|
||||
4. succeed
|
||||
initial condition: None
|
||||
test environment: SSC_T1_1
|
||||
execution time: 0
|
||||
module: System
|
||||
sub module: NVS
|
||||
version: v1 (2017-06-01)
|
||||
CI ready: 'SpecialJob'
|
||||
level: Integration
|
||||
allow fail: ''
|
||||
cmd set:
|
||||
- "NVSTest/NVSCompatibleWiFi"
|
||||
- - nvs_path = "nvs_bin_folder"
|
||||
- ['']
|
||||
|
@ -0,0 +1,98 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
from TCAction import TCActionBase
|
||||
from TCAction import PerformanceTCBase
|
||||
from NativeLog import NativeLog
|
||||
|
||||
|
||||
SOFTAP_SSID = "SoftAPSSID4NVSCompatibleTest"
|
||||
SOFTAP_PASSWORD = "SoftAPPassword4NVSCompatibleTest"
|
||||
|
||||
NVS_FILE_NAME = "nvs_wifi.bin"
|
||||
|
||||
|
||||
class TestCase(PerformanceTCBase.PerformanceTCBase):
|
||||
|
||||
def __init__(self, test_case, test_env, timeout=30, log_path=TCActionBase.LOG_PATH):
|
||||
PerformanceTCBase.PerformanceTCBase.__init__(self, test_case, test_env, timeout=timeout, log_path=log_path)
|
||||
self.nvs_path = ""
|
||||
# load param from excel
|
||||
cmd_set = test_case["cmd set"]
|
||||
for i in range(1, len(cmd_set)):
|
||||
if cmd_set[i][0] != "dummy":
|
||||
cmd_string = "self." + cmd_set[i][0]
|
||||
exec cmd_string
|
||||
|
||||
def get_nvs_bins(self):
|
||||
if os.path.exists(self.nvs_path) is False:
|
||||
NativeLog.add_trace_critical("NVS path is not correct")
|
||||
files = []
|
||||
else:
|
||||
files = [os.path.join(self.nvs_path, x) for x in os.listdir(self.nvs_path)]
|
||||
return filter(lambda f: NVS_FILE_NAME in f, files)
|
||||
|
||||
def check_nvs(self, nvs_bin):
|
||||
branch_name = os.path.basename(nvs_bin)
|
||||
branch_name.replace("___", "/")
|
||||
result = True
|
||||
|
||||
ssc1_port = self.test_env.get_port_by_name("SSC1")
|
||||
ap_ssid = self.get_parameter("ap_ssid")
|
||||
|
||||
self.flush_data("SSC1")
|
||||
|
||||
# first download
|
||||
ssc1_port.flash_nvs(nvs_bin)
|
||||
self.check_response("SSC1", "ready!!!")
|
||||
# set to sta mode and join ap
|
||||
if self.check_response("SSC1", "+JAP:CONNECTED,%s" % ap_ssid, timeout=15) is False:
|
||||
NativeLog.add_trace_critical("Failed to join AP on: " + branch_name)
|
||||
result = False
|
||||
|
||||
self.serial_write_line("SSC1", "op -Q")
|
||||
if self.check_response("SSC1", "+CURMODE:3") is False:
|
||||
NativeLog.add_trace_critical("Failed on verifying WIFI mode on: " + branch_name)
|
||||
result = False
|
||||
|
||||
self.serial_write_line("SSC1", "ap -Q")
|
||||
if self.check_response("SSC1", "+APCONFIG:%s,%s" % (SOFTAP_SSID, SOFTAP_PASSWORD)) is False:
|
||||
NativeLog.add_trace_critical("Failed on verifying SoftAP config on: " + branch_name)
|
||||
result = False
|
||||
return result
|
||||
|
||||
def dump_nvs(self):
|
||||
ssc1_port = self.test_env.get_port_by_name("SSC1")
|
||||
ap_ssid = self.get_parameter("ap_ssid")
|
||||
ap_password = self.get_parameter("ap_password")
|
||||
|
||||
# first erase NVS
|
||||
ssc1_port.flash_nvs(None)
|
||||
|
||||
self.check_response("SSC1", "ready!!!")
|
||||
|
||||
self.serial_write_line("SSC1", "op -S -o 3")
|
||||
self.check_response("SSC1", "+MODE:OK")
|
||||
self.serial_write_line("SSC1", "sta -C -s %s -p %s" % (ap_ssid, ap_password))
|
||||
self.check_response("SSC1", "+JAP:CONNECTED,%s" % ap_ssid, timeout=20)
|
||||
self.serial_write_line("SSC1", "ap -S -s %s -p %s -t 3" % (SOFTAP_SSID, SOFTAP_PASSWORD))
|
||||
self.check_response("SSC1", "+SAP:OK")
|
||||
time.sleep(1)
|
||||
|
||||
idf_path = os.getenv("IDF_PATH")
|
||||
|
||||
ssc1_port.dump_nvs(os.path.join(idf_path, NVS_FILE_NAME))
|
||||
|
||||
def cleanup(self):
|
||||
# make sure dump nvs will be executed
|
||||
self.dump_nvs()
|
||||
|
||||
def process(self):
|
||||
result = True
|
||||
nvs_bins = self.get_nvs_bins()
|
||||
|
||||
for nvs_bin in nvs_bins:
|
||||
result = result and self.check_nvs(nvs_bin)
|
||||
|
||||
if result is True:
|
||||
self.set_result("Succeed")
|
Loading…
Reference in New Issue
Block a user