Skip to content

Commit b0ea9c5

Browse files
committed
option_test.go: update tests that add field EnableSecurityMode.
1 parent 747172f commit b0ea9c5

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

option/option_test.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
var template []byte
1111

1212
func init() {
13-
inst := bytes.Repeat([]byte{0xFF}, 64)
13+
inst := bytes.Repeat([]byte{0xFF}, 256)
1414
stub := bytes.Repeat([]byte{0x00}, StubSize)
1515
stub[0] = StubMagic
1616
template = append(inst, stub...)
@@ -19,6 +19,7 @@ func init() {
1919
func TestSet(t *testing.T) {
2020
t.Run("common", func(t *testing.T) {
2121
opts := &Options{
22+
EnableSecurityMode: true,
2223
DisableDetector: true,
2324
DisableSysmon: true,
2425
DisableWatchdog: true,
@@ -28,15 +29,16 @@ func TestSet(t *testing.T) {
2829
}
2930
output, err := Set(template, opts)
3031
require.NoError(t, err)
31-
o, err := Get(output, 64)
32+
o, err := Get(output, 256)
3233
require.NoError(t, err)
3334
require.Equal(t, opts, o)
3435

3536
output, err = Set(template, nil)
3637
require.NoError(t, err)
37-
o, err = Get(output, 64)
38+
o, err = Get(output, 256)
3839
require.NoError(t, err)
3940
opts = &Options{
41+
EnableSecurityMode: false,
4042
DisableDetector: false,
4143
DisableSysmon: false,
4244
DisableWatchdog: false,
@@ -54,7 +56,7 @@ func TestSet(t *testing.T) {
5456
})
5557

5658
t.Run("invalid runtime option stub", func(t *testing.T) {
57-
tpl := make([]byte, StubSize+64)
59+
tpl := make([]byte, StubSize+256)
5860

5961
output, err := Set(tpl, nil)
6062
require.EqualError(t, err, "invalid runtime option stub")
@@ -65,6 +67,7 @@ func TestSet(t *testing.T) {
6567
func TestGet(t *testing.T) {
6668
t.Run("common", func(t *testing.T) {
6769
opts := &Options{
70+
EnableSecurityMode: true,
6871
DisableDetector: true,
6972
DisableSysmon: true,
7073
DisableWatchdog: true,
@@ -75,7 +78,7 @@ func TestGet(t *testing.T) {
7578
output, err := Set(template, opts)
7679
require.NoError(t, err)
7780

78-
o, err := Get(output, 64)
81+
o, err := Get(output, 256)
7982
require.NoError(t, err)
8083
require.Equal(t, opts, o)
8184
})
@@ -87,15 +90,15 @@ func TestGet(t *testing.T) {
8790
})
8891

8992
t.Run("invalid offset to the option stub", func(t *testing.T) {
90-
tpl := make([]byte, StubSize+64)
93+
tpl := make([]byte, StubSize+256)
9194

9295
opts, err := Get(tpl, len(tpl))
9396
require.EqualError(t, err, "invalid offset to the option stub")
9497
require.Nil(t, opts)
9598
})
9699

97100
t.Run("invalid runtime option stub", func(t *testing.T) {
98-
tpl := make([]byte, StubSize+64)
101+
tpl := make([]byte, StubSize+256)
99102

100103
opts, err := Get(tpl, len(tpl)-StubSize)
101104
require.EqualError(t, err, "invalid runtime option stub")
@@ -105,6 +108,7 @@ func TestGet(t *testing.T) {
105108

106109
func TestFlag(t *testing.T) {
107110
opts := Options{
111+
EnableSecurityMode: true,
108112
DisableDetector: true,
109113
DisableSysmon: true,
110114
DisableWatchdog: true,

0 commit comments

Comments
 (0)