mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-25 16:50:14 +00:00
Improve processor detection to use the new dedicated ARMv4T, ARMv5TE and ARMv8-A binaries we provide for FTL.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
326168509c
commit
01c9bbd3ca
2 changed files with 112 additions and 29 deletions
|
@ -187,7 +187,55 @@ def test_FTL_detect_aarch64_no_errors(Pihole):
|
|||
''')
|
||||
expected_stdout = info_box + ' FTL Checks...'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + ' Detected ARM-aarch64 architecture'
|
||||
expected_stdout = tick_box + ' Detected AArch64 (64 Bit ARM) processor'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + ' Downloading and Installing FTL'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
||||
|
||||
def test_FTL_detect_armv4t_no_errors(Pihole):
|
||||
'''
|
||||
confirms only armv4t package is downloaded for FTL engine
|
||||
'''
|
||||
# mock uname to return armv4t platform
|
||||
mock_command('uname', {'-m': ('armv4t', '0')}, Pihole)
|
||||
# mock ldd to respond with ld-linux shared library
|
||||
mock_command('ldd', {'/bin/ls': ('/lib/ld-linux.so.3', '0')}, Pihole)
|
||||
detectPlatform = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
create_pihole_user
|
||||
funcOutput=$(get_binary_name)
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}"
|
||||
theRest="${funcOutput%pihole-FTL*}"
|
||||
FTLdetect "${binary}" "${theRest}"
|
||||
''')
|
||||
expected_stdout = info_box + ' FTL Checks...'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + (' Detected ARMv4 processor')
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + ' Downloading and Installing FTL'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
||||
|
||||
def test_FTL_detect_armv5te_no_errors(Pihole):
|
||||
'''
|
||||
confirms only armv5te package is downloaded for FTL engine
|
||||
'''
|
||||
# mock uname to return armv5te platform
|
||||
mock_command('uname', {'-m': ('armv5te', '0')}, Pihole)
|
||||
# mock ldd to respond with ld-linux shared library
|
||||
mock_command('ldd', {'/bin/ls': ('/lib/ld-linux.so.3', '0')}, Pihole)
|
||||
detectPlatform = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
create_pihole_user
|
||||
funcOutput=$(get_binary_name)
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}"
|
||||
theRest="${funcOutput%pihole-FTL*}"
|
||||
FTLdetect "${binary}" "${theRest}"
|
||||
''')
|
||||
expected_stdout = info_box + ' FTL Checks...'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + (' Detected ARMv5 (or newer) processor')
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + ' Downloading and Installing FTL'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
@ -199,7 +247,7 @@ def test_FTL_detect_armv6l_no_errors(Pihole):
|
|||
'''
|
||||
# mock uname to return armv6l platform
|
||||
mock_command('uname', {'-m': ('armv6l', '0')}, Pihole)
|
||||
# mock ldd to respond with aarch64 shared library
|
||||
# mock ldd to respond with ld-linux-armhf shared library
|
||||
mock_command('ldd', {'/bin/ls': ('/lib/ld-linux-armhf.so.3', '0')}, Pihole)
|
||||
detectPlatform = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
|
@ -211,8 +259,8 @@ def test_FTL_detect_armv6l_no_errors(Pihole):
|
|||
''')
|
||||
expected_stdout = info_box + ' FTL Checks...'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + (' Detected ARM-hf architecture '
|
||||
'(armv6 or lower)')
|
||||
expected_stdout = tick_box + (' Detected ARMv6 processor '
|
||||
'(with hard-float support)')
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + ' Downloading and Installing FTL'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
@ -224,7 +272,7 @@ def test_FTL_detect_armv7l_no_errors(Pihole):
|
|||
'''
|
||||
# mock uname to return armv7l platform
|
||||
mock_command('uname', {'-m': ('armv7l', '0')}, Pihole)
|
||||
# mock ldd to respond with aarch64 shared library
|
||||
# mock ldd to respond with ld-linux-armhf shared library
|
||||
mock_command('ldd', {'/bin/ls': ('/lib/ld-linux-armhf.so.3', '0')}, Pihole)
|
||||
detectPlatform = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
|
@ -236,7 +284,32 @@ def test_FTL_detect_armv7l_no_errors(Pihole):
|
|||
''')
|
||||
expected_stdout = info_box + ' FTL Checks...'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + ' Detected ARM-hf architecture (armv7+)'
|
||||
expected_stdout = tick_box + (' Detected ARMv7 processor '
|
||||
'(with hard-float support)')
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + ' Downloading and Installing FTL'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
||||
|
||||
def test_FTL_detect_armv8a_no_errors(Pihole):
|
||||
'''
|
||||
confirms only armv8a package is downloaded for FTL engine
|
||||
'''
|
||||
# mock uname to return armv8a platform
|
||||
mock_command('uname', {'-m': ('armv8a', '0')}, Pihole)
|
||||
# mock ldd to respond with ld-linux-armhf shared library
|
||||
mock_command('ldd', {'/bin/ls': ('/lib/ld-linux-armhf.so.3', '0')}, Pihole)
|
||||
detectPlatform = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
create_pihole_user
|
||||
funcOutput=$(get_binary_name)
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}"
|
||||
theRest="${funcOutput%pihole-FTL*}"
|
||||
FTLdetect "${binary}" "${theRest}"
|
||||
''')
|
||||
expected_stdout = info_box + ' FTL Checks...'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + ' Detected ARMv8 (or newer) processor'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + ' Downloading and Installing FTL'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
@ -256,7 +329,7 @@ def test_FTL_detect_x86_64_no_errors(Pihole):
|
|||
''')
|
||||
expected_stdout = info_box + ' FTL Checks...'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + ' Detected x86_64 architecture'
|
||||
expected_stdout = tick_box + ' Detected x86_64 processor'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + ' Downloading and Installing FTL'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
@ -274,7 +347,7 @@ def test_FTL_detect_unknown_no_errors(Pihole):
|
|||
theRest="${funcOutput%pihole-FTL*}"
|
||||
FTLdetect "${binary}" "${theRest}"
|
||||
''')
|
||||
expected_stdout = 'Not able to detect architecture (unknown: mips)'
|
||||
expected_stdout = 'Not able to detect processor (unknown: mips)'
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue