From b4450a39184156a0a2e1c180e71866ba6258d14c Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 20 Feb 2017 04:44:31 -0800 Subject: [PATCH 1/2] Mock ldd command response. Test aarch64 detection Signed-off-by: Dan Schaper --- test/test_automated_install.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 5096e2b2..76fbe7ef 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -301,30 +301,14 @@ def test_FTL_download_aarch64_no_errors(Pihole): ''' confirms only aarch64 package is downloaded for FTL engine ''' # mock uname to return aarch64 platform mock_command('uname', {'-m':('aarch64', '0')}, Pihole) + # mock ldd to respond with aarch64 shared library + mock_command('ldd', {'/bin/ls':('/lib/ld-linux-aarch64.so.1', '0')}, Pihole) detectPlatform = Pihole.run(''' source /opt/pihole/basic-install.sh FTLdownload - touch /lib/ld-linux-aarch64.so.1 ''') expected_stdout = 'Detected ARM-aarch64 architecture' assert expected_stdout in detectPlatform.stdout - FTL_binary = Pihole.run('echo ${binary}').stdout - assert 'pihole-FTL-aarch64-linux-gnu' in FTL_binary - -def test_FTL_download_armv6l_Pi_Zero_no_errors(Pihole): - ''' confirms only armv6l package is downloaded for FTL engine (Pi-Zero) ''' - # mock uname to return aarch64 platform - mock_command('uname', {'-m':('armv6l', '0')}, Pihole) - detectPlatform = Pihole.run(''' - source /opt/pihole/basic-install.sh - FTLdownload - touch /lib/ld-linux-armhf.so.3 - ls -lach /lib/ - ''') - expected_stdout = 'Detected ARM-hf architecture' - assert expected_stdout in detectPlatform.stdout - FTL_binary = Pihole.run('echo ${binary}').stdout - assert 'pihole-FTL-arm-linux-gnueabihf' in FTL_binary # Helper functions def mock_command(script, args, container): From 59d6907d71bc8e3b601ae33d78530a78a6fcc9c0 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Mon, 20 Feb 2017 06:24:35 -0800 Subject: [PATCH 2/2] Test aarch64 detection Signed-off-by: Dan Schaper --- test/test_automated_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 76fbe7ef..4e84c147 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -297,7 +297,7 @@ def test_update_package_cache_failure_no_errors(Pihole): assert 'ERROR' in updateCache.stdout assert 'done!' not in updateCache.stdout -def test_FTL_download_aarch64_no_errors(Pihole): +def test_FTL_detect_aarch64_no_errors(Pihole): ''' confirms only aarch64 package is downloaded for FTL engine ''' # mock uname to return aarch64 platform mock_command('uname', {'-m':('aarch64', '0')}, Pihole)