You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
774 B

  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package route
  5. import "testing"
  6. func TestFetchAndParseRIBOnDarwin(t *testing.T) {
  7. for _, typ := range []RIBType{sysNET_RT_FLAGS, sysNET_RT_DUMP2, sysNET_RT_IFLIST2} {
  8. var lastErr error
  9. var ms []Message
  10. for _, af := range []int{sysAF_UNSPEC, sysAF_INET, sysAF_INET6} {
  11. rs, err := fetchAndParseRIB(af, typ)
  12. if err != nil {
  13. lastErr = err
  14. continue
  15. }
  16. ms = append(ms, rs...)
  17. }
  18. if len(ms) == 0 && lastErr != nil {
  19. t.Error(typ, lastErr)
  20. continue
  21. }
  22. ss, err := msgs(ms).validate()
  23. if err != nil {
  24. t.Error(typ, err)
  25. continue
  26. }
  27. for _, s := range ss {
  28. t.Log(s)
  29. }
  30. }
  31. }