From edb78a4954289e908d798306682c63d2f7667f8f Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Mon, 16 Jan 2023 13:04:27 +0800 Subject: [PATCH 1/4] artifactory test: Add check for default files Signed-off-by: Trecia Agoylo --- test/test_files.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/test_files.py b/test/test_files.py index 7289b7a..4878141 100644 --- a/test/test_files.py +++ b/test/test_files.py @@ -8,6 +8,7 @@ from functools import partial DESRIPTOR_FILE="/boot/kuiper.json" +DEFAULT_FILES = ["/boot/README.txt", "/boot/VERSION.txt", "/boot/kuiper.json", "/boot/uEnv.txt"] # DESRIPTOR_FILE="/boot/projects_descriptor.json" def get_project_details(pcn): @@ -252,5 +253,15 @@ def test_artifactory_boot_files(artifactory_bts): else: fail_flag = True + # check for missing default files + for file in DEFAULT_FILES: + condition = (file in normalized_abts) + message = 'Missing default file: {}'.format(file) + check.is_true(condition, message) + if condition: + print(f'Found {file}') + else: + fail_flag = True + assert not fail_flag From 02bfbe177a6f6d04144ad51e5cbb5dbbf4ae1daa Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Thu, 1 Jun 2023 13:38:10 +0800 Subject: [PATCH 2/4] Update pytest version in requirements.txt --- requirements.txt | Bin 936 -> 472 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/requirements.txt b/requirements.txt index 9185d1475580640dc6677612588e5cadd9b198d4..d247e81241fab33ce30ef86f51adaefd197e4e63 100644 GIT binary patch literal 472 zcmXw0yH3O~5bPu6Q_jkhh{6S;paGPY3i*7Avq~HX$H(Dsqu`VH1!f)5d1hy4cGth( zKNmNBoRkkVDjl4Ud8UH1q;HqsU!i^P1oc{pYQ z+?1Y`p%ntmg`71fLN=Bw*z9J8<45xB4;rb6BLDyZ literal 936 zcmYjQO;3YR5ZtqgKLsMRwejG=c<`det0zM#UqK5NYW2^nGrR1A5D1Uiotd5Y`1{>U zC$)S^B$*s#ltxOt<#_9`{*g<$z?!QMV7Z*}wZXcOL2hv+63ZI*Rj3?MVOWZp8qgfdCAgh6QQnpE=FopvM;Ux%T0?Fsucr!U?xccB29+9GOPxe3EA_vZ zonq!amW^T$ioKw3M0Y2L(9by&T+E}vcV z#9(>ZJgndpOuYpUIhfTJcd80K5;>u>nxTk0-?T`C6ULzGpN-$|GhpC7uUMkv{0uS)%Yp%~F%0 zH)o!`Ejt=87s&23`5-s Date: Mon, 18 Sep 2023 09:40:47 +0800 Subject: [PATCH 3/4] update test_files.py Signed-off-by: Agoylo --- test/test_files.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/test_files.py b/test/test_files.py index 4878141..43a2064 100644 --- a/test/test_files.py +++ b/test/test_files.py @@ -202,6 +202,8 @@ def test_bashrc_file(host): def test_boot_files(host, project_name): fail_flag = False bts = get_boot_files(host, DESRIPTOR_FILE, project_name) + print(bts) + # check for missing files based from the descriptor for bt in bts: condition = host.file(bt[1]).exists message = 'Missing File: Project:{} File:{}'.format(bt[0],bt[1]) @@ -210,6 +212,27 @@ def test_boot_files(host, project_name): print(f'Found {bt}') else: fail_flag = True + + # check for unexpected files not defined on the descriptor + bts_from_descriptor = [ bt[1] for bt in bts ] + for bt in bts: + condition = (bt in bts_from_descriptor) + message = 'Undefined file: {}'.format(bt) + check.is_true(condition, message) + if condition: + print(f'Found {bt}') + else: + fail_flag = True + + # check for missing default files + for file in DEFAULT_FILES: + condition = (file in bts) + message = 'Missing default file: {}'.format(file) + check.is_true(condition, message) + if condition: + print(f'Found {file}') + else: + fail_flag = True assert not fail_flag From ec2e96c3aeccb28e8a0ca66a27dee61a4f54ec99 Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Thu, 21 Sep 2023 12:33:06 +0800 Subject: [PATCH 4/4] test_files: update test_boot_files against sd card files Signed-off-by: Trecia Agoylo --- test/test_files.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test_files.py b/test/test_files.py index 43a2064..c2b4f04 100644 --- a/test/test_files.py +++ b/test/test_files.py @@ -202,7 +202,6 @@ def test_bashrc_file(host): def test_boot_files(host, project_name): fail_flag = False bts = get_boot_files(host, DESRIPTOR_FILE, project_name) - print(bts) # check for missing files based from the descriptor for bt in bts: condition = host.file(bt[1]).exists @@ -214,19 +213,20 @@ def test_boot_files(host, project_name): fail_flag = True # check for unexpected files not defined on the descriptor + actual_files = host.run("find /boot -type f -not -name *.dtbo").stdout.split() bts_from_descriptor = [ bt[1] for bt in bts ] - for bt in bts: - condition = (bt in bts_from_descriptor) - message = 'Undefined file: {}'.format(bt) + for af in actual_files: + condition = (af in bts_from_descriptor) + message = 'Undefined file: {}'.format(af) check.is_true(condition, message) if condition: - print(f'Found {bt}') + print(f'Found {af}') else: fail_flag = True # check for missing default files for file in DEFAULT_FILES: - condition = (file in bts) + condition = (file in actual_files) message = 'Missing default file: {}'.format(file) check.is_true(condition, message) if condition: