Skip to content

Commit 481d313

Browse files
committed
tests/ports/psoc6: Check vfs-tests working.
Signed-off-by: NikhitaR-IFX <nikhita.rajasekhar@infineon.com>
1 parent 561d509 commit 481d313

3 files changed

Lines changed: 15 additions & 71 deletions

File tree

.github/workflows/ports_psoc6.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,12 @@ jobs:
7171
- name: Run psoc6 tests
7272
timeout-minutes: 12
7373
run: |
74-
./tests/ports/psoc6/run_psoc6_tests.sh --test-suite ci-tests --board ${{ matrix.board }} --hil ${{ runner.name }}
75-
76-
74+
devs=$(python3 ./tools/psoc6/get-devs.py port -b ${{ matrix.board }} -y tools/psoc6/${{ runner.name }}-devs.yml)
75+
dev_test=${devs[0]}
76+
./tests/ports/psoc6/run_psoc6_tests.sh --test-suite vfs-flash --board ${{ matrix.board }} -d $dev_test --hil ${{ runner.name }}
77+
78+
#./tests/ports/psoc6/run_psoc6_tests.sh --test-suite ci-tests --board ${{ matrix.board }} --hil ${{ runner.name }}
79+
7780
- name: Container teardown
7881
if: failure() || success()
7982
run: |

tests/ports/psoc6/mp_custom/fs.py

Lines changed: 5 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import sys
33
import os
44
import logging
5-
import time
65

76
logger = logging.getLogger("fs")
87
logging.basicConfig(format="%(levelname)s: %(message)s", encoding="utf-8", level=logging.WARNING)
@@ -11,21 +10,12 @@
1110
test_type = sys.argv[2]
1211
mem_type = sys.argv[3]
1312

14-
'''device = "/dev/ttyACM1"
15-
test_type = "basic"
16-
mem_type = "flash"'''
17-
18-
13+
# tests inputs and script paths
1914
test_input_dir = "./ports/psoc6/inputs"
2015
test_script_dir = "./ports/psoc6/mp_custom"
21-
curr_dir = os.getcwd()
22-
print(f"Current directory: {curr_dir}")
23-
24-
mpremote = "~/MPY/micropython/tools/mpremote/mpremote.py"
25-
2616

2717
# List of mpremote commands
28-
# mpr_connect = f"{mpremote} connect {device}"
18+
mpr_connect = f"../tools/mpremote/mpremote.py connect {device}"
2919
mpr_run_script = ""
3020

3121
# Remote directory path
@@ -167,7 +157,7 @@ def copy_files(input_cp_files):
167157

168158
logger.debug(f"cp_files command: {cp_cmd}")
169159

170-
print("Copying files...", subprocess.run(cp_cmd, shell=True, capture_output=True))
160+
subprocess.run(cp_cmd, shell=True, capture_output=True)
171161

172162

173163
def validate_test(files, file_sizes):
@@ -194,7 +184,7 @@ def validate_test(files, file_sizes):
194184
def cp_files_test(input_files, input_files_size):
195185
rm_files_if_exist(input_files)
196186
copy_files(input_files)
197-
# validate_test(input_files, input_files_size)
187+
validate_test(input_files, input_files_size)
198188

199189

200190
def large_file_tests(device, test_type, mem_type):
@@ -206,54 +196,4 @@ def large_file_tests(device, test_type, mem_type):
206196
cp_files_test(input_files, input_files_size)
207197

208198

209-
def copy_files_to_dev(cmd, file):
210-
mpr_cp = f"{mpr_connect} fs cp {file} :/"
211-
print("Copying files...", subprocess.run(mpr_cp, shell=True, capture_output=True))
212-
213-
214-
# Function to find the micropython project root directory
215-
def find_micropython_root(start_path="/"):
216-
for root, dirs, files in os.walk(start_path):
217-
if os.path.basename(root) == "micropython":
218-
return root
219-
return None
220-
221-
222-
# Function to search for a file within the micropython project directory
223-
def find_file_in_micropython(root_dir, filename):
224-
for root, dirs, files in os.walk(root_dir):
225-
if filename in files:
226-
return os.path.join(root, filename)
227-
return None
228-
229-
230-
# Main script logic
231-
if __name__ == "__main__":
232-
# Find the micropython project root starting from the root of the filesystem
233-
root_dir = find_micropython_root(start_path="/")
234-
235-
if root_dir is None:
236-
print("micropython directory not found")
237-
else:
238-
print(f"Found micropython project root at: {root_dir}")
239-
240-
filename = "mpremote.py"
241-
mpremote = find_file_in_micropython(root_dir, filename)
242-
243-
if mpremote:
244-
print(f"File found at: {mpremote}")
245-
else:
246-
print(f"File {filename} not found in the micropython project.")
247-
248-
mpr_connect = f"{mpremote} connect {device}"
249-
250-
ip_file = "test_fs_small_file.txt"
251-
test_ip = find_file_in_micropython(root_dir, ip_file)
252-
253-
mpr_cp = f"{mpr_connect} fs cp {test_ip} :/"
254-
print("Copying files...", subprocess.run(mpr_cp, shell=True, capture_output=True))
255-
256-
# connect_to_dev_test()
257-
# large_file_tests(device, test_type, mem_type)
258-
259-
# copy_files_to_dev()
199+
large_file_tests(device, test_type, mem_type)

tests/ports/psoc6/run_psoc6_tests.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ while getopts "b:d:h:s:t:x" o; do
8888
exit 1
8989
;;
9090
esac
91-
done2
91+
done
9292

9393
if [ -z "${dev_test}" ]; then
9494
dev_test="/dev/ttyACM0"
@@ -170,12 +170,13 @@ mpremote_vfs_large_file_tests() {
170170
enable_adv_tests="adv"
171171
fi
172172

173-
python3 ${tests_psoc6_dir}/mp_custom/fs.py --device ${dev_test} --test_type ${enable_adv_tests} --mem_type ${storage_device}
173+
python3 ${tests_psoc6_dir}/mp_custom/fs.py ${dev_test} ${enable_adv_tests} ${storage_device}
174174

175175
update_test_result $?
176176
}
177177

178178
vfs_flash_tests() {
179+
#devs=($(python ${tools_psoc6_dir}/get-devs.py port -b ${board} -y ${tools_psoc6_dir}/${hil_name}-devs.yml))
179180
run_tests "file system flash" ${dev_test} \
180181
"extmod/vfs_basic.py
181182
extmod/vfs_lfs_superblock.py
@@ -443,4 +444,4 @@ case ${test_suite} in
443444
;;
444445
esac
445446

446-
exit ${exit_result}
447+
exit ${exit_result}

0 commit comments

Comments
 (0)