Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An update to vmtest #2918

Merged
merged 14 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions cmds/exp/pox/pox_vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ import (
"testing"
"time"

"github.com/hugelgupf/vmtest"
"github.com/hugelgupf/vmtest/govmtest"
"github.com/hugelgupf/vmtest/guest"
"github.com/hugelgupf/vmtest/qemu"
)

func TestIntegrationPox(t *testing.T) {
vmtest.SkipIfNotArch(t, qemu.ArchAMD64)
qemu.SkipIfNotArch(t, qemu.ArchAMD64)

vmtest.RunGoTestsInVM(t, []string{"github.com/u-root/u-root/cmds/exp/pox"},
vmtest.WithVMOpt(vmtest.WithQEMUFn(qemu.WithVMTimeout(time.Minute))),
govmtest.Run(t, "vm",
govmtest.WithPackageToTest("github.com/u-root/u-root/cmds/exp/pox"),
govmtest.WithQEMUFn(qemu.WithVMTimeout(time.Minute)),
)
}

Expand Down
22 changes: 11 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/google/go-cmp v0.5.9
github.com/google/go-tpm v0.9.1-0.20230914180155-ee6cbcd136f8
github.com/google/uuid v1.3.0
github.com/hugelgupf/vmtest v0.0.0-20240127073930-89f92b39a1fa
github.com/hugelgupf/vmtest v0.0.0-20240216064925-0561770280a1
github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2
github.com/intel-go/cpuid v0.0.0-20200819041909-2aa72927c3e2
github.com/kevinburke/ssh_config v1.1.0
Expand All @@ -32,19 +32,20 @@ require (
github.com/rekby/gpt v0.0.0-20200219180433-a930afbc6edc
github.com/safchain/ethtool v0.0.0-20200218184317-f459e2d13664
github.com/spf13/pflag v1.0.5
github.com/u-root/gobusybox/src v0.0.0-20231228173702-b69f654846aa
github.com/u-root/gobusybox/src v0.0.0-20240212035024-44ff0bf359ad
github.com/u-root/iscsinl v0.1.1-0.20210528121423-84c32645822a
github.com/u-root/uio v0.0.0-20240208165552-2ba503b08e3b
github.com/u-root/mkuimage v0.0.0-20240216050315-5f527d1fae2e
github.com/u-root/uio v0.0.0-20240209044354-b3d14b93376a
github.com/ulikunitz/xz v0.5.11
github.com/vishvananda/netlink v1.2.1-beta.2
github.com/vtolstov/go-ioctl v0.0.0-20151206205506-6be9cced4810
golang.org/x/crypto v0.17.0
golang.org/x/crypto v0.18.0
golang.org/x/exp v0.0.0-20231219180239-dc181d75b848
golang.org/x/net v0.19.0
golang.org/x/sys v0.15.0
golang.org/x/term v0.15.0
golang.org/x/net v0.20.0
golang.org/x/sys v0.16.0
golang.org/x/term v0.16.0
golang.org/x/text v0.14.0
golang.org/x/tools v0.16.1
golang.org/x/tools v0.17.0
gopkg.in/yaml.v2 v2.2.8
mvdan.cc/sh/v3 v3.7.0
pack.ag/tftp v1.0.1-0.20181129014014-07909dfbde3c
Expand All @@ -61,8 +62,7 @@ require (
github.com/cloudflare/circl v1.3.7 // indirect
github.com/containerd/console v1.0.4-0.20230706203907-8f6c4e4faef5 // indirect
github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hugelgupf/go-shlex v0.0.0-20200702092117-c80c9d0918fa // indirect
github.com/josharian/native v1.1.0 // indirect
github.com/jsimonetti/rtnetlink v1.3.5 // indirect
github.com/kaey/framebuffer v0.0.0-20140402104929-7b385489a1ff // indirect
Expand All @@ -83,7 +83,7 @@ require (
github.com/vishvananda/netns v0.0.4 // indirect
golang.org/x/arch v0.2.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sync v0.6.0 // indirect
)

retract (
Expand Down
45 changes: 22 additions & 23 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,14 @@ github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 h1:CVuJwN34x4xM2aT4s
github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2/go.mod h1:nOFQdrUlIlx6M6ODdSpBj1NVA+VgLC6kmw60mkw34H4=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hexdigest/gowrap v1.1.7/go.mod h1:Z+nBFUDLa01iaNM+/jzoOA1JJ7sm51rnYFauKFUB5fs=
github.com/hexdigest/gowrap v1.1.8/go.mod h1:H/JiFmQMp//tedlV8qt2xBdGzmne6bpbaSuiHmygnMw=
github.com/hugelgupf/go-shlex v0.0.0-20200702092117-c80c9d0918fa h1:s3KPo0nThtvjEamF/aElD4k5jSsBHew3/sgNTnth+2M=
github.com/hugelgupf/go-shlex v0.0.0-20200702092117-c80c9d0918fa/go.mod h1:I1uW6ymzwsy5TlQgD1bFAghdMgBYqH1qtCeHoZgHMqs=
github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714 h1:/jC7qQFrv8CrSJVmaolDVOxTfS9kc36uB6H40kdbQq8=
github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714/go.mod h1:2Goc3h8EklBH5mspfHFxBnEoURQCGzQQH1ga9Myjvis=
github.com/hugelgupf/vmtest v0.0.0-20240127073930-89f92b39a1fa h1:2q0UvEA7TSTrjU4aFrpF6u28tHat3KnCkqsy/gB86v0=
github.com/hugelgupf/vmtest v0.0.0-20240127073930-89f92b39a1fa/go.mod h1:Z22CpRFjhoR/NoxBeEuyeGTwMC7G5s4RfKa9Bs/j74w=
github.com/hugelgupf/vmtest v0.0.0-20240216064925-0561770280a1 h1:jWoR2Yqg8tzM0v6LAiP7i1bikZJu3gxpgvu3g1Lw+a0=
github.com/hugelgupf/vmtest v0.0.0-20240216064925-0561770280a1/go.mod h1:B63hDJMhTupLWCHwopAyEo7wRFowx9kOc8m8j1sfOqE=
github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2 h1:9K06NfxkBh25x56yVhWWlKFE8YpicaSfHwoV8SFbueA=
github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2/go.mod h1:3A9PQ1cunSDF/1rbTq99Ts4pVnycWg+vlPkfeD2NLFI=
github.com/intel-go/cpuid v0.0.0-20200819041909-2aa72927c3e2 h1:h+RKaNPjka7LRJGoeub/IQBdXSoEaJjfADkBq02hvjw=
Expand Down Expand Up @@ -218,12 +215,14 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/twitchtv/twirp v5.8.0+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A=
github.com/u-root/gobusybox/src v0.0.0-20231228173702-b69f654846aa h1:unMPGGK/CRzfg923allsikmvk2l7beBeFPUNC4RVX/8=
github.com/u-root/gobusybox/src v0.0.0-20231228173702-b69f654846aa/go.mod h1:Zj4Tt22fJVn/nz/y6Ergm1SahR9dio1Zm/D2/S0TmXM=
github.com/u-root/gobusybox/src v0.0.0-20240212035024-44ff0bf359ad h1:lUSEFqsEuc+c+sTI5jVEC0wWw0FOuXZbrYGZbxQL19E=
github.com/u-root/gobusybox/src v0.0.0-20240212035024-44ff0bf359ad/go.mod h1:vN1IwhlCo7gTDTJDUs6WCKM4/C2uiq5w0XvZCqLtb5s=
github.com/u-root/iscsinl v0.1.1-0.20210528121423-84c32645822a h1:A0sK7WEodak7eVd21MOEatnh2pfAAwZaEPSIEEsjctQ=
github.com/u-root/iscsinl v0.1.1-0.20210528121423-84c32645822a/go.mod h1:RWIgJWqm9/0gjBZ0Hl8iR6MVGzZ+yAda2uqqLmetE2I=
github.com/u-root/uio v0.0.0-20240208165552-2ba503b08e3b h1:Owe+CKkw6LTqi3yWk9SQ0dcxavV19HVu48Zkl0lD4vk=
github.com/u-root/uio v0.0.0-20240208165552-2ba503b08e3b/go.mod h1:P3a5rG4X7tI17Nn3aOIAYr5HbIMukwXG0urG0WuL8OA=
github.com/u-root/mkuimage v0.0.0-20240216050315-5f527d1fae2e h1:KRdkURI+8KMNx+3XxTIFFpgTchYUaptp40Vq0wBaQE8=
github.com/u-root/mkuimage v0.0.0-20240216050315-5f527d1fae2e/go.mod h1:04Id/CtMh7fm3TB2crUokz9qNhn7q8Qturr4k0teSDI=
github.com/u-root/uio v0.0.0-20240209044354-b3d14b93376a h1:BH1SOPEvehD2kVrndDnGJiUF0TrBpNs+iyYocu6h0og=
github.com/u-root/uio v0.0.0-20240209044354-b3d14b93376a/go.mod h1:P3a5rG4X7tI17Nn3aOIAYr5HbIMukwXG0urG0WuL8OA=
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
Expand All @@ -242,8 +241,8 @@ golang.org/x/arch v0.2.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20231219180239-dc181d75b848 h1:+iq7lrkxmFNBM7xx+Rae2W6uyPfhPeDWD+n+JgppptE=
golang.org/x/exp v0.0.0-20231219180239-dc181d75b848/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
Expand All @@ -258,15 +257,15 @@ golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand All @@ -287,12 +286,12 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
Expand All @@ -304,8 +303,8 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA=
golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc=
golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
Expand Down
27 changes: 0 additions & 27 deletions integration/generic-tests/basic_test.go

This file was deleted.

99 changes: 45 additions & 54 deletions integration/generic-tests/dhclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ import (
"testing"
"time"

"github.com/hugelgupf/vmtest"
"github.com/hugelgupf/vmtest/qemu"
"github.com/hugelgupf/vmtest/qemu/qnetwork"
"github.com/u-root/gobusybox/src/pkg/golang"
"github.com/hugelgupf/vmtest/scriptvm"
"github.com/u-root/mkuimage/uimage"
"github.com/u-root/u-root/pkg/testutil"
"github.com/u-root/u-root/pkg/uroot"
)

// TestDhclientQEMU4 uses QEMU's DHCP server to test dhclient.
Expand Down Expand Up @@ -51,28 +50,29 @@ func TestDhclientQEMU4(t *testing.T) {
cat ./foobar
sleep 5
`, port)
vm := vmtest.StartVMAndRunCmds(t, script,
// Build dhclient as a binary command to get accurate GOCOVERDIR
// integration coverage data (busybox rewrites command code).
vmtest.WithBinaryCommands(
"github.com/u-root/u-root/cmds/core/dhclient",

vm := scriptvm.Start(t, "vm", script,
scriptvm.WithUimage(
// Build dhclient as a binary command to get accurate GOCOVERDIR
// integration coverage data (busybox rewrites command code).
uimage.WithCoveredCommands(
"github.com/u-root/u-root/cmds/core/dhclient",
),
uimage.WithBusyboxCommands(
"github.com/u-root/u-root/cmds/core/cat",
"github.com/u-root/u-root/cmds/core/ip",
"github.com/u-root/u-root/cmds/core/sleep",
"github.com/u-root/u-root/cmds/core/wget",
),
),
// Build dhclient (and all other initramfs commands) with coverage enabled.
vmtest.WithGoBuildOpts(&golang.BuildOpts{
ExtraArgs: []string{"-cover", "-coverpkg=github.com/u-root/u-root/...", "-covermode=atomic"},
}),
vmtest.WithMergedInitramfs(uroot.Opts{Commands: uroot.BusyBoxCmds(
"github.com/u-root/u-root/cmds/core/cat",
"github.com/u-root/u-root/cmds/core/ip",
"github.com/u-root/u-root/cmds/core/sleep",
"github.com/u-root/u-root/cmds/core/wget",
)}),
vmtest.WithQEMUFn(
scriptvm.WithQEMUFn(
qemu.WithVMTimeout(time.Minute),
qnetwork.IPv4HostNetwork("192.168.0.0/24"),
qemu.ServeHTTP(s, ln),
qnetwork.ServeHTTP(s, ln),
qemu.VirtioRandom(),
),
)
t.Logf("Command: %v", vm.CmdlineQuoted())
if _, err := vm.Console.ExpectString("Configured eth0 with IPv4 DHCP Lease"); err != nil {
t.Errorf("%s: %v", testutil.NowLog(), err)
}
Expand All @@ -94,23 +94,18 @@ func TestDhclientTimesOut(t *testing.T) {
`

net := qnetwork.NewInterVM()
vm := vmtest.StartVMAndRunCmds(t, script,
// Build dhclient as a binary command to get accurate GOCOVERDIR
// integration coverage data (busybox rewrites command code).
vmtest.WithBinaryCommands(
"github.com/u-root/u-root/cmds/core/dhclient",
vm := scriptvm.Start(t, "vm", script,
scriptvm.WithUimage(
// Build dhclient as a binary command to get accurate GOCOVERDIR
// integration coverage data (busybox rewrites command code).
uimage.WithCoveredCommands("github.com/u-root/u-root/cmds/core/dhclient"),
uimage.WithBusyboxCommands("github.com/u-root/u-root/cmds/core/sleep"),
),
// Build dhclient (and all other initramfs commands) with coverage enabled.
vmtest.WithGoBuildOpts(&golang.BuildOpts{
ExtraArgs: []string{"-cover", "-coverpkg=github.com/u-root/u-root/...", "-covermode=atomic"},
}),
vmtest.WithMergedInitramfs(uroot.Opts{Commands: uroot.BusyBoxCmds(
"github.com/u-root/u-root/cmds/core/sleep",
)}),
vmtest.WithQEMUFn(
scriptvm.WithQEMUFn(
qemu.WithVMTimeout(time.Minute),
// An empty network so DHCP has something to send packets to.
net.NewVM(),
qemu.VirtioRandom(),
),
)

Expand Down Expand Up @@ -140,39 +135,35 @@ func TestDhclient6(t *testing.T) {
// We don't currently have a radvd server we can use, so we also cannot
// try to download a file using the DHCP configuration.
net := qnetwork.NewInterVM()
serverVM := vmtest.StartVMAndRunCmds(t, serverScript,
vmtest.WithName("TestDhclient6_Server"),
vmtest.WithMergedInitramfs(uroot.Opts{Commands: uroot.BusyBoxCmds(
"github.com/u-root/u-root/cmds/core/ip",
"github.com/u-root/u-root/cmds/exp/pxeserver",
)}),
vmtest.WithQEMUFn(
serverVM := scriptvm.Start(t, "dhcp6_server", serverScript,
scriptvm.WithUimage(
uimage.WithBusyboxCommands(
"github.com/u-root/u-root/cmds/core/ip",
"github.com/u-root/u-root/cmds/exp/pxeserver",
),
),
scriptvm.WithQEMUFn(
qemu.WithVMTimeout(time.Minute),
net.NewVM(),
qemu.VirtioRandom(),
),
)

clientScript := `
dhclient -ipv4=false -vv
ip a
`
clientVM := vmtest.StartVMAndRunCmds(t, clientScript,
vmtest.WithName("TestDhclient6_Client"),
// Build dhclient as a binary command to get accurate GOCOVERDIR
// integration coverage data (busybox rewrites command code).
vmtest.WithBinaryCommands(
"github.com/u-root/u-root/cmds/core/dhclient",
clientVM := scriptvm.Start(t, "dhcp6_client", clientScript,
scriptvm.WithUimage(
// Build dhclient as a binary command to get accurate GOCOVERDIR
// integration coverage data (busybox rewrites command code).
uimage.WithCoveredCommands("github.com/u-root/u-root/cmds/core/dhclient"),
uimage.WithBusyboxCommands("github.com/u-root/u-root/cmds/core/ip"),
),
// Build dhclient (and all other initramfs commands) with coverage enabled.
vmtest.WithGoBuildOpts(&golang.BuildOpts{
ExtraArgs: []string{"-cover", "-coverpkg=github.com/u-root/u-root/...", "-covermode=atomic"},
}),
vmtest.WithMergedInitramfs(uroot.Opts{Commands: uroot.BusyBoxCmds(
"github.com/u-root/u-root/cmds/core/ip",
)}),
vmtest.WithQEMUFn(
scriptvm.WithQEMUFn(
qemu.WithVMTimeout(time.Minute),
net.NewVM(),
qemu.VirtioRandom(),
),
)

Expand Down
Loading
Loading