Skip to content

Instantly share code, notes, and snippets.

@abrodkin
Last active February 12, 2021 15:02
Show Gist options
  • Save abrodkin/68698361ac89b8bdc3c7747eab60e7ff to your computer and use it in GitHub Desktop.
Save abrodkin/68698361ac89b8bdc3c7747eab60e7ff to your computer and use it in GitHub Desktop.

To run glibc test-suite on target without native toolchain we need to have the following 2 requirements:

  1. Host executes tests on target via SSH so we need to have SSH server up and running on target. Moreover we need to either enable paswordless login via SSH or install user's SSH key on target so that execution scripts may connect to target via SSH without asking user for entering pasword all the time (there're 5k+ tests).

  2. Host's filesystem must be accessible from target. Moreover paths must match exactly on both devices (i.e. "/home/username/glibc-testsuite" in both cases must be available and contain exectly the same data) because tests are being built on the fly and immediately get executed via SSH. Thus we need to mount host's filesystem with glibc testsuite on target.

SSH SERVER

This is simple - enable BR2_PACKAGE_OPENSSH in buildroot and patch "output/target/etc/ssh/sshd_config" with setting:

PermitRootLogin yes
PermitEmptyPasswords yes

This way there will be no need to install any keys.

MOUNT HOST'S FILESYSTEM

We have at least 2 options here: SSHFS (since SSH server is already there) or NFS.

SSHFS

  1. Enable CONFIG_FUSE_FS in Linux kernel
  2. Enable BR2_PACKAGE_SSHFS in Buildroot
  3. On target run:
mkdir -p /home/username
sshfs -o idmap=user username@host_ip_address:/home/username /home/username

NFS

  1. On host 1.1. Configure exports (in "/etc/exports"):

    /home/username *(rw,all_squash,anonuid=username_uid,anongid=username_gid)
    

    Note "all_squash" and "anonuid"/"anongid" are required for mapping target's user to you user on host. Otherwise use of "no_root_squash" is very dangerous as target's root will be treated as a root on your host and it: a) Might be really harmful b) Target will generate files on host's filesystem owned by host's "root" user so if glibc's testsuite is executed by normal user test results won't be accessible for it. And idea to run testsuite by local "root" is very dangerous so please don't do that! 1.2. Start NFS server 1.3. Open NFS and RPC-BIND ports in firewall

  2. On target run:

mkdir -p /home/username
mount -t nfs host_ip_address:/home/username /home/username -o nolock

START GLIBC TESTSUITE ON HOST

cd build/
make test-wrapper='__full_path_to__/scripts/cross-test-ssh.sh root@target_ip_address' xcheck

USEFUL TIPS

On target

Use Google DNS which correctly resolves IPv6 names to addresses and thus tst-getaddrinfo4 passes reliably:

echo "nameserver 8.8.8.8" > /etc/resolv.conf

On host

Get all available results while tests are still being executed:

find . -type f -name '*.test-result' -exec cat {} \; > all-tests.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment