for fuzzing the imapserver and smtpserver use different config files than regular tests

otherwise they cannot be running at the same time, they could overwrite each
other's files.
This commit is contained in:
Mechiel Lukkien 2023-05-22 15:37:03 +02:00
parent 1f5ab1b795
commit dcc051e149
No known key found for this signature in database
7 changed files with 60 additions and 2 deletions

2
.gitignore vendored
View file

@ -7,6 +7,7 @@
/testdata/exportmbox/ /testdata/exportmbox/
/testdata/httpaccount/data/ /testdata/httpaccount/data/
/testdata/imap/data/ /testdata/imap/data/
/testdata/imapserverfuzz/data/
/testdata/imaptest/data/ /testdata/imaptest/data/
/testdata/integration/data/ /testdata/integration/data/
/testdata/junk/*.bloom /testdata/junk/*.bloom
@ -18,6 +19,7 @@
/testdata/smtp/sendlimit/data/ /testdata/smtp/sendlimit/data/
/testdata/smtp/catchall/data/ /testdata/smtp/catchall/data/
/testdata/smtp/postmaster/ /testdata/smtp/postmaster/
/testdata/smtpserverfuzz/data/
/testdata/store/data/ /testdata/store/data/
/testdata/train/ /testdata/train/
/cover.out /cover.out

View file

@ -59,7 +59,7 @@ func FuzzServer(f *testing.F) {
} }
mox.Context = context.Background() mox.Context = context.Background()
mox.ConfigStaticPath = "../testdata/imap/mox.conf" mox.ConfigStaticPath = "../testdata/imapserverfuzz/mox.conf"
mox.MustLoadConfig(false) mox.MustLoadConfig(false)
dataDir := mox.ConfigDirPath(mox.Conf.Static.DataDir) dataDir := mox.ConfigDirPath(mox.Conf.Static.DataDir)
os.RemoveAll(dataDir) os.RemoveAll(dataDir)

View file

@ -30,7 +30,7 @@ func FuzzServer(f *testing.F) {
f.Add("QUIT") f.Add("QUIT")
mox.Context = ctxbg mox.Context = ctxbg
mox.ConfigStaticPath = "../testdata/smtp/mox.conf" mox.ConfigStaticPath = "../testdata/smtpserverfuzz/mox.conf"
mox.MustLoadConfig(false) mox.MustLoadConfig(false)
dataDir := mox.ConfigDirPath(mox.Conf.Static.DataDir) dataDir := mox.ConfigDirPath(mox.Conf.Static.DataDir)
os.RemoveAll(dataDir) os.RemoveAll(dataDir)

15
testdata/imapserverfuzz/domains.conf vendored Normal file
View file

@ -0,0 +1,15 @@
Domains:
mox.example:
LocalpartCaseSensitive: false
Accounts:
mjl:
Domain: mox.example
Destinations:
mjl@mox.example: nil
JunkFilter:
Threshold: 0.95
Params:
Twograms: true
MaxPower: 0.1
TopWords: 10
IgnoreWords: 0.1

15
testdata/imapserverfuzz/mox.conf vendored Normal file
View file

@ -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
testdata/smtpserverfuzz/domains.conf vendored Normal file
View file

@ -0,0 +1,17 @@
Domains:
mox.example: nil
mox2.example: nil
Accounts:
mjl:
Domain: mox.example
Destinations:
mjl@mox.example: nil
mjl@mox2.example: nil
JunkFilter:
Threshold: 0.9
Params:
Onegrams: true
MaxPower: 0.01
TopWords: 10
IgnoreWords: 0.1
RareWords: 2

9
testdata/smtpserverfuzz/mox.conf vendored Normal file
View file

@ -0,0 +1,9 @@
DataDir: data
User: 1000
LogLevel: trace
Hostname: mox.example
Postmaster:
Account: mjl
Mailbox: postmaster
Listeners:
local: nil