Add a regression test for hostname / nss_myhostname

Issue #1248.