Skip to content

Commit 57e7d02

Browse files
fix regression due to the rebase
Signed-off-by: Alessandro Carminati <[email protected]>
1 parent 44cb96a commit 57e7d02

File tree

2 files changed

+35
-31
lines changed

2 files changed

+35
-31
lines changed

nav_cgo_test.go

+21-18
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
package main
1010

1111
import (
12+
"nav/config"
1213
"database/sql"
1314
"database/sql/driver"
1415
"github.com/DATA-DOG/go-sqlmock"
16+
c "nav/constants"
1517
. "github.com/onsi/ginkgo"
1618
. "github.com/onsi/gomega"
1719
)
@@ -20,25 +22,25 @@ var _ = Describe("Nav Tests", func() {
2022
Describe("opt2num", func() {
2123
When("Using a valid options key", func() {
2224
It("Should return the correct value for graphOnly", func() {
23-
Expect(opt2num("graphOnly")).To(Equal(graphOnly))
25+
Expect(opt2num("graphOnly")).To(Equal(c.GraphOnly))
2426
})
2527

2628
It("Should return the correct value for jsonOutputPlain", func() {
27-
Expect(opt2num("jsonOutputPlain")).To(Equal(jsonOutputPlain))
29+
Expect(opt2num("jsonOutputPlain")).To(Equal(c.JsonOutputPlain))
2830
})
2931

3032
It("Should return the correct value for jsonOutputB64", func() {
31-
Expect(opt2num("jsonOutputB64")).To(Equal(jsonOutputB64))
33+
Expect(opt2num("jsonOutputB64")).To(Equal(c.JsonOutputB64))
3234
})
3335

3436
It("Should return the correct value for jsonOutputGZB64", func() {
35-
Expect(opt2num("jsonOutputGZB64")).To(Equal(jsonOutputGZB64))
37+
Expect(opt2num("jsonOutputGZB64")).To(Equal(c.JsonOutputGZB64))
3638
})
3739
})
3840

3941
When("Using an invalid options key", func() {
4042
It("Should return 0", func() {
41-
Expect(opt2num("invalidKey")).To(Equal(invalidOutput))
43+
Expect(opt2num("invalidKey")).To(Equal(c.InvalidOutput))
4244
})
4345
})
4446
})
@@ -304,19 +306,20 @@ dgraph G {
304306
dok.cache.entries = map[int]entry{}
305307
dok.cache.successors = map[int][]entry{}
306308
dok.cache.subSys = map[string]string{}
307-
testConfig := configuration{
308-
DBDriver: "postgres",
309-
DBDSN: "host=dbs.hqhome163.com port=5432 user=alessandro password=<password> dbname=kernel_bin sslmode=disable",
310-
Symbol: "__x64_sys_getpid",
311-
Instance: 16,
312-
Mode: printAll,
313-
ExcludedBefore: []string{"__fentry__", "__stack_chk_fail"},
314-
ExcludedAfter: []string{"^kfree$", "^_raw_spin_lock$", "^_raw_spin_unlock$", "^panic$", "^call_rcu$", "^__call_rcu$", "__rcu_read_unlock", "__rcu_read_lock", "path_openat"},
315-
TargetSubsys: []string{},
316-
MaxDepth: 0, //0: no limit
317-
Jout: "graphOnly",
318-
Graphviz: oText,
319-
cmdlineNeeds: map[string]bool{},
309+
testConfig:= config.Config{
310+
ConfValues: config.ConfValues{
311+
DBDriver: "postgres",
312+
DBDSN: "host=dbs.hqhome163.com port=5432 user=alessandro password=<password> dbname=kernel_bin sslmode=disable",
313+
Symbol: "__x64_sys_getpid",
314+
DBInstance: 16,
315+
Mode: c.PrintAll,
316+
ExcludedBefore: []string{"__fentry__", "__stack_chk_fail"},
317+
ExcludedAfter: []string{"^kfree$", "^_raw_spin_lock$", "^_raw_spin_unlock$", "^panic$", "^call_rcu$", "^__call_rcu$", "__rcu_read_unlock", "__rcu_read_lock", "path_openat"},
318+
TargetSubsys: []string{},
319+
MaxDepth: 0, //0: no limit
320+
Type: "graphOnly",
321+
Graphviz: c.OText,
322+
},
320323
}
321324

322325
dot, err := generateOutput(dok, &testConfig)

nav_test.go

+14-13
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,20 @@ rankdir="LR"
178178
d.LOADsymbSubsysValues([]int{472055, 472243}, 16, "{\"FuncName\":\"__x64_sys_getpid\", \"subsystems\":[]},{\"FuncName\":\"__task_pid_nr_ns\", \"subsystems\":[]}", nil)
179179
d.LOADgetEntryByIdValues(472055, 16, entry{symbol: "__x64_sys_getpid", fn: "kernel/sys.c", sourceRef: "", addressRef: "", subsys: []string{}, symId: 472055}, nil)
180180
d.LOADgetEntryByIdValues(472243, 16, entry{symbol: "__task_pid_nr_ns", fn: "kernel/pid.c", sourceRef: "", addressRef: "", subsys: []string{}, symId: 472243}, nil)
181-
testConfig := configuration{
182-
DBDriver: "postgres",
183-
DBDSN: "host=dbs.hqhome163.com port=5432 user=alessandro password=<password> dbname=kernel_bin sslmode=disable",
184-
Symbol: "__x64_sys_getpid",
185-
Instance: 16,
186-
Mode: printAll,
187-
ExcludedBefore: []string{"__fentry__", "__stack_chk_fail"},
188-
ExcludedAfter: []string{"^kfree$", "^_raw_spin_lock$", "^_raw_spin_unlock$", "^panic$", "^call_rcu$", "^__call_rcu$", "__rcu_read_unlock", "__rcu_read_lock", "path_openat"},
189-
TargetSubsys: []string{},
190-
MaxDepth: 0, //0: no limit
191-
Jout: "graphOnly",
192-
Graphviz: oText,
193-
cmdlineNeeds: map[string]bool{},
181+
testConfig:= config.Config{
182+
ConfValues: config.ConfValues{
183+
DBDriver: "postgres",
184+
DBDSN: "host=dbs.hqhome163.com port=5432 user=alessandro password=<password> dbname=kernel_bin sslmode=disable",
185+
Symbol: "__x64_sys_getpid",
186+
DBInstance: 16,
187+
Mode: c.PrintAll,
188+
ExcludedBefore: []string{"__fentry__", "__stack_chk_fail"},
189+
ExcludedAfter: []string{"^kfree$", "^_raw_spin_lock$", "^_raw_spin_unlock$", "^panic$", "^call_rcu$", "^__call_rcu$", "__rcu_read_unlock", "__rcu_read_lock", "path_openat"},
190+
TargetSubsys: []string{},
191+
MaxDepth: 0, //0: no limit
192+
Type: "graphOnly",
193+
Graphviz: c.OText,
194+
},
194195
}
195196
dot, err := generateOutput(d, &testConfig)
196197
It("Should return syntax correct json with no error", func() {

0 commit comments

Comments
 (0)