This test worked by trying to make an HTTP connection to a path under
100.100.100.200, which if successful would indicate that it's an
Alibaba cloud instance. We only try the connection if SM-BIOS
information indicates the hardware OEM is Alibaba.
However 'make check' would hang if 100.100.100.200 doesn't immediately
reject the connection. I found that GCE is such an environment where
connecting to this address would hang rather than reject. GCE does
not have Alibaba hardware of course, but when doing 'make check' we
fake dmidecode data.
Make the test more robust by only trying to connect when we know we're
not in 'make check'.
Fixes: commit
b7cc3d93a613ef6d0ac5ccd6e32cc3d66e057243
# Check for Alibaba Cloud
if echo "$dmi" | grep -q 'Manufacturer: Alibaba'; then
# Check for Alibaba Cloud ECS Bare Metal (EBM) Instance
- if ( { echo -e "GET /latest/meta-datainstance/instance-type HTTP/1.0\r\nHost: 100.100.100.200\r\n\r" >&3; grep -sq 'ebm' <&3 ; } 3<> /dev/tcp/100.100.100.200/80 ) 2>/dev/null ; then
+ if [ "x$root" = "x" ] && ( { echo -e "GET /latest/meta-datainstance/instance-type HTTP/1.0\r\nHost: 100.100.100.200\r\n\r" >&3; grep -sq 'ebm' <&3 ; } 3<> /dev/tcp/100.100.100.200/80 ) 2>/dev/null ; then
echo "alibaba_cloud-ebm"
else
echo "alibaba_cloud"