Skip to content

Commit

Permalink
fix: update typo and add args for fuzz test
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Mar 28, 2024
1 parent 56dee82 commit b373b76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ golint:
mkdir -p $(CURDIR)/.coverage

# -run flag ensures that the fuzz test won't be run
# because the fuzz test needs to run with the running UPF
# because the fuzz test needs a UPF to run
test: .coverage
go test -race -coverprofile=.coverage/coverage-unit.txt -covermode=atomic -run=^Test -v ./...

Expand Down
33 changes: 7 additions & 26 deletions fuzz/ie_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package fuzz

import (
"crypto/rand"
"flag"
"math/big"
"testing"
"time"
Expand All @@ -28,31 +29,11 @@ func getRand(n int) int {
return int(res.Int64())
}

// Example of a basic function test
// func TestBasicFunction(t *testing.T) {
// sim := export.NewPfcpSimCfg("eth0", "192.168.0.5", "127.0.0.8")
// err := sim.InitPFCPSim()
// if err != nil {
// require.NoError(t, err, "InitPFCPSim failed")
// }
// err = sim.Associate()
// if err != nil {
// require.NoError(t, err, "Associate failed")
// }
// defer func() {
// err = sim.TerminatePFCPSim()
// require.NoError(t, err)
// }()
// err = sim.CreateSession(2,
// session.PdrNoFuzz,
// session.QerNoFuzz,
// session.FarNoFuzz,
// session.UrrNoFuzz,
// uint(0))
// if err != nil {
// require.NoError(t, err, "CreateSession failed")
// }
// }
var (
iface = flag.String("iface", "eth0", "the interface name you used to establish the connection with UPF.")
upfN3 = flag.String("upfN3", "192.168.0.5", "the N3 interface address of the UPF")
upfN4 = flag.String("upfN4", "127.0.0.8", "the N4 interface address of the UPF")
)

func Fuzz(f *testing.F) {
var testcases []uint
Expand All @@ -69,7 +50,7 @@ func Fuzz(f *testing.F) {
f.Fuzz(func(t *testing.T, input uint) {
time.Sleep(5 * time.Second)

sim := export.NewPfcpSimCfg("eth0", "192.168.0.5", "127.0.0.8")
sim := export.NewPfcpSimCfg(*iface, *upfN3, *upfN4)

err := sim.InitPFCPSim()
if err != nil {
Expand Down

0 comments on commit b373b76

Please sign in to comment.