mirror of
https://github.com/pi-hole/pi-hole
synced 2024-11-18 14:18:15 +00:00
Print detected CPU arch
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
1c4e58efe3
commit
913be6c349
@ -1844,30 +1844,30 @@ get_binary_name() {
|
||||
else
|
||||
# If ARMv8 or higher is found (e.g., BCM2837 as found in Raspberry Pi Model 3B)
|
||||
if [[ "${cpu_arch}" == "v7" || "${rev}" -gt 7 ]]; then
|
||||
printf "%b %b Detected ARMv8 (or newer) architecture\\n" "${OVER}" "${TICK}"
|
||||
printf "%b %b Detected ARMv7 (or newer) architecture (%s)\\n" "${OVER}" "${TICK}" "${cpu_arch}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-armv7"
|
||||
elif [[ "${rev}" -gt 6 ]]; then
|
||||
# Otherwise, if ARMv7 is found (e.g., BCM2836 as found in Raspberry Pi Model 2)
|
||||
printf "%b %b Detected ARMv7 architecture\\n" "${OVER}" "${TICK}"
|
||||
printf "%b %b Detected ARMv7 architecture (%s)\\n" "${OVER}" "${TICK}" "${cpu_arch}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-armv6"
|
||||
elif [[ "${cpu_arch}" == "v5TE" || "${rev}" -gt 5 ]]; then
|
||||
# Check if the system is using GLIBC 2.29 or higher
|
||||
if [[ -n "${l_glibc_version}" && "$(printf '%s\n' "2.29" "${l_glibc_version}" | sort -V | head -n1)" == "2.29" ]]; then
|
||||
# If so, use the ARMv6 binary (e.g., BCM2835 as found in Raspberry Pi Zero and Model 1)
|
||||
printf "%b %b Detected ARMv6 architecture (running GLIBC 2.29 or higher)\\n" "${OVER}" "${TICK}"
|
||||
printf "%b %b Detected ARMv6 architecture (running GLIBC 2.29 or higher, %s)\\n" "${OVER}" "${TICK}" "${cpu_arch}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-armv5"
|
||||
else
|
||||
# Otherwise, use the ARMv5 binary (e.g., BCM2835 as found in Raspberry Pi Zero and Model 1)
|
||||
printf "%b %b Detected ARMv6 architecture (running GLIBC older than 2.29)\\n" "${OVER}" "${TICK}"
|
||||
printf "%b %b Detected ARMv6 architecture (running GLIBC older than 2.29, %s)\\n" "${OVER}" "${TICK}" "${cpu_arch}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-armv4"
|
||||
fi
|
||||
else
|
||||
# Otherwise, use the ARMv4 binary (e.g., BCM2835 as found in Raspberry Pi Zero and Model 1)
|
||||
printf "%b %b Detected ARMv4 or ARMv5 architecture\\n" "${OVER}" "${TICK}"
|
||||
printf "%b %b Detected ARMv4 or ARMv5 architecture (%s)\\n" "${OVER}" "${TICK}" "${cpu_arch}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-armv4"
|
||||
fi
|
||||
|
@ -286,7 +286,7 @@ def test_FTL_detect_armv4_no_errors(host):
|
||||
)
|
||||
expected_stdout = info_box + " FTL Checks..."
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Detected ARMv4 or ARMv5 architecture"
|
||||
expected_stdout = tick_box + " Detected ARMv4 or ARMv5 architecture (armv4t)"
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Downloading and Installing FTL"
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
@ -319,7 +319,7 @@ def test_FTL_detect_armv5_no_errors(host):
|
||||
)
|
||||
expected_stdout = info_box + " FTL Checks..."
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Detected ARMv4 or ARMv5 architecture"
|
||||
expected_stdout = tick_box + " Detected ARMv4 or ARMv5 architecture (armv5te)"
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Downloading and Installing FTL"
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
@ -358,7 +358,7 @@ def test_FTL_detect_armv6_old_no_errors(host):
|
||||
expected_stdout = info_box + " FTL Checks..."
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + (
|
||||
" Detected ARMv6 architecture (running GLIBC older than 2.29)"
|
||||
" Detected ARMv6 architecture (running GLIBC older than 2.29, armv6l)"
|
||||
)
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Downloading and Installing FTL"
|
||||
@ -398,7 +398,7 @@ def test_FTL_detect_armv6_recent_no_errors(host):
|
||||
expected_stdout = info_box + " FTL Checks..."
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + (
|
||||
" Detected ARMv6 architecture (running GLIBC 2.29 or higher)"
|
||||
" Detected ARMv6 architecture (running GLIBC 2.29 or higher, armv6l)"
|
||||
)
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Downloading and Installing FTL"
|
||||
@ -465,7 +465,40 @@ def test_FTL_detect_armv7l_no_errors(host):
|
||||
)
|
||||
expected_stdout = info_box + " FTL Checks..."
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + (" Detected ARMv7 architecture")
|
||||
expected_stdout = tick_box + (" Detected ARMv7 architecture (armv7l)")
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Downloading and Installing FTL"
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
||||
|
||||
def test_FTL_detect_armv7_no_errors(host):
|
||||
"""
|
||||
confirms only armv7 package is downloaded for FTL engine
|
||||
"""
|
||||
# mock uname to return armv7 platform
|
||||
mock_command("uname", {"-m": ("armv7", "0")}, host)
|
||||
# mock readelf to respond with armv7 CPU architecture
|
||||
mock_command_2(
|
||||
"readelf",
|
||||
{
|
||||
"-A /bin/sh": ("Tag_CPU_arch: armv7", "0"),
|
||||
"-A /usr/bin/sh": ("Tag_CPU_arch: armv7", "0"),
|
||||
},
|
||||
host,
|
||||
)
|
||||
detectPlatform = host.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 ARMv7 architecture (armv7)")
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Downloading and Installing FTL"
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
@ -498,7 +531,7 @@ def test_FTL_detect_armv8a_no_errors(host):
|
||||
)
|
||||
expected_stdout = info_box + " FTL Checks..."
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Detected ARMv8 (or newer) architecture"
|
||||
expected_stdout = tick_box + " Detected ARMv7 (or newer) architecture (armv8a)"
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Downloading and Installing FTL"
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
Loading…
Reference in New Issue
Block a user