Skip to content

Commit

Permalink
for fuzzing the imapserver and smtpserver use different config files …
Browse files Browse the repository at this point in the history
…than regular tests

otherwise they cannot be running at the same time, they could overwrite each
other's files.
  • Loading branch information
mjl- committed May 22, 2023
1 parent 1f5ab1b commit dcc051e
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/testdata/exportmbox/
/testdata/httpaccount/data/
/testdata/imap/data/
/testdata/imapserverfuzz/data/
/testdata/imaptest/data/
/testdata/integration/data/
/testdata/junk/*.bloom
Expand All @@ -18,6 +19,7 @@
/testdata/smtp/sendlimit/data/
/testdata/smtp/catchall/data/
/testdata/smtp/postmaster/
/testdata/smtpserverfuzz/data/
/testdata/store/data/
/testdata/train/
/cover.out
Expand Down
2 changes: 1 addition & 1 deletion imapserver/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func FuzzServer(f *testing.F) {
}

mox.Context = context.Background()
mox.ConfigStaticPath = "../testdata/imap/mox.conf"
mox.ConfigStaticPath = "../testdata/imapserverfuzz/mox.conf"
mox.MustLoadConfig(false)
dataDir := mox.ConfigDirPath(mox.Conf.Static.DataDir)
os.RemoveAll(dataDir)
Expand Down
2 changes: 1 addition & 1 deletion smtpserver/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func FuzzServer(f *testing.F) {
f.Add("QUIT")

mox.Context = ctxbg
mox.ConfigStaticPath = "../testdata/smtp/mox.conf"
mox.ConfigStaticPath = "../testdata/smtpserverfuzz/mox.conf"
mox.MustLoadConfig(false)
dataDir := mox.ConfigDirPath(mox.Conf.Static.DataDir)
os.RemoveAll(dataDir)
Expand Down
15 changes: 15 additions & 0 deletions testdata/imapserverfuzz/domains.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Domains:
mox.example:
LocalpartCaseSensitive: false
Accounts:
mjl:
Domain: mox.example
Destinations:
[email protected]: nil
JunkFilter:
Threshold: 0.95
Params:
Twograms: true
MaxPower: 0.1
TopWords: 10
IgnoreWords: 0.1
15 changes: 15 additions & 0 deletions testdata/imapserverfuzz/mox.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
DataDir: data
User: 1000
LogLevel: trace
Hostname: mox.example
Listeners:
local:
IPs:
- 0.0.0.0
IMAP:
Enabled: true
Port: 1143
NoRequireSTARTTLS: true
Postmaster:
Account: mjl
Mailbox: postmaster
17 changes: 17 additions & 0 deletions testdata/smtpserverfuzz/domains.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Domains:
mox.example: nil
mox2.example: nil
Accounts:
mjl:
Domain: mox.example
Destinations:
[email protected]: nil
[email protected]: nil
JunkFilter:
Threshold: 0.9
Params:
Onegrams: true
MaxPower: 0.01
TopWords: 10
IgnoreWords: 0.1
RareWords: 2
9 changes: 9 additions & 0 deletions testdata/smtpserverfuzz/mox.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DataDir: data
User: 1000
LogLevel: trace
Hostname: mox.example
Postmaster:
Account: mjl
Mailbox: postmaster
Listeners:
local: nil

0 comments on commit dcc051e

Please sign in to comment.