xref: /aosp_15_r20/external/lz4/tests/README.md (revision 27162e4e17433d5aa7cb38e7b6a433a09405fc7f)
1*27162e4eSAndroid Build Coastguard WorkerPrograms and scripts for automated testing of LZ4
2*27162e4eSAndroid Build Coastguard Worker=======================================================
3*27162e4eSAndroid Build Coastguard Worker
4*27162e4eSAndroid Build Coastguard WorkerThis directory contains the following programs and scripts:
5*27162e4eSAndroid Build Coastguard Worker- `datagen` : Synthetic and parametrable data generator, for tests
6*27162e4eSAndroid Build Coastguard Worker- `frametest` : Test tool that checks lz4frame integrity on target platform
7*27162e4eSAndroid Build Coastguard Worker- `fullbench`  : Precisely measure speed for each lz4 inner functions
8*27162e4eSAndroid Build Coastguard Worker- `fuzzer`  : Test tool, to check lz4 integrity on target platform
9*27162e4eSAndroid Build Coastguard Worker- `test-lz4-speed.py` : script for testing lz4 speed difference between commits
10*27162e4eSAndroid Build Coastguard Worker- `test-lz4-versions.py` : compatibility test between lz4 versions stored on Github
11*27162e4eSAndroid Build Coastguard Worker
12*27162e4eSAndroid Build Coastguard Worker
13*27162e4eSAndroid Build Coastguard Worker#### `test-lz4-versions.py` - script for testing lz4 interoperability between versions
14*27162e4eSAndroid Build Coastguard Worker
15*27162e4eSAndroid Build Coastguard WorkerThis script creates `versionsTest` directory to which lz4 repository is cloned.
16*27162e4eSAndroid Build Coastguard WorkerThen all tagged (released) versions of lz4 are compiled.
17*27162e4eSAndroid Build Coastguard WorkerIn the following step interoperability between lz4 versions is checked.
18*27162e4eSAndroid Build Coastguard Worker
19*27162e4eSAndroid Build Coastguard Worker
20*27162e4eSAndroid Build Coastguard Worker#### `test-lz4-speed.py` - script for testing lz4 speed difference between commits
21*27162e4eSAndroid Build Coastguard Worker
22*27162e4eSAndroid Build Coastguard WorkerThis script creates `speedTest` directory to which lz4 repository is cloned.
23*27162e4eSAndroid Build Coastguard WorkerThen it compiles all branches of lz4 and performs a speed benchmark for a given list of files (the `testFileNames` parameter).
24*27162e4eSAndroid Build Coastguard WorkerAfter `sleepTime` (an optional parameter, default 300 seconds) seconds the script checks repository for new commits.
25*27162e4eSAndroid Build Coastguard WorkerIf a new commit is found it is compiled and a speed benchmark for this commit is performed.
26*27162e4eSAndroid Build Coastguard WorkerThe results of the speed benchmark are compared to the previous results.
27*27162e4eSAndroid Build Coastguard WorkerIf compression or decompression speed for one of lz4 levels is lower than `lowerLimit` (an optional parameter, default 0.98) the speed benchmark is restarted.
28*27162e4eSAndroid Build Coastguard WorkerIf second results are also lower than `lowerLimit` the warning e-mail is sent to recipients from the list (the `emails` parameter).
29*27162e4eSAndroid Build Coastguard Worker
30*27162e4eSAndroid Build Coastguard WorkerAdditional remarks:
31*27162e4eSAndroid Build Coastguard Worker- To be sure that speed results are accurate the script should be run on a "stable" target system with no other jobs running in parallel
32*27162e4eSAndroid Build Coastguard Worker- Using the script with virtual machines can lead to large variations of speed results
33*27162e4eSAndroid Build Coastguard Worker- The speed benchmark is not performed until computers' load average is lower than `maxLoadAvg` (an optional parameter, default 0.75)
34*27162e4eSAndroid Build Coastguard Worker- The script sends e-mails using `mutt`; if `mutt` is not available it sends e-mails without attachments using `mail`; if both are not available it only prints a warning
35*27162e4eSAndroid Build Coastguard Worker
36*27162e4eSAndroid Build Coastguard Worker
37*27162e4eSAndroid Build Coastguard WorkerThe example usage with two test files, one e-mail address, and with an additional message:
38*27162e4eSAndroid Build Coastguard Worker```
39*27162e4eSAndroid Build Coastguard Worker./test-lz4-speed.py "silesia.tar calgary.tar" "[email protected]" --message "tested on my laptop" --sleepTime 60
40*27162e4eSAndroid Build Coastguard Worker```
41*27162e4eSAndroid Build Coastguard Worker
42*27162e4eSAndroid Build Coastguard WorkerTo run the script in background please use:
43*27162e4eSAndroid Build Coastguard Worker```
44*27162e4eSAndroid Build Coastguard Workernohup ./test-lz4-speed.py testFileNames emails &
45*27162e4eSAndroid Build Coastguard Worker```
46*27162e4eSAndroid Build Coastguard Worker
47*27162e4eSAndroid Build Coastguard WorkerThe full list of parameters:
48*27162e4eSAndroid Build Coastguard Worker```
49*27162e4eSAndroid Build Coastguard Workerpositional arguments:
50*27162e4eSAndroid Build Coastguard Worker  testFileNames         file names list for speed benchmark
51*27162e4eSAndroid Build Coastguard Worker  emails                list of e-mail addresses to send warnings
52*27162e4eSAndroid Build Coastguard Worker
53*27162e4eSAndroid Build Coastguard Workeroptional arguments:
54*27162e4eSAndroid Build Coastguard Worker  -h, --help            show this help message and exit
55*27162e4eSAndroid Build Coastguard Worker  --message MESSAGE     attach an additional message to e-mail
56*27162e4eSAndroid Build Coastguard Worker  --lowerLimit LOWERLIMIT
57*27162e4eSAndroid Build Coastguard Worker                        send email if speed is lower than given limit
58*27162e4eSAndroid Build Coastguard Worker  --maxLoadAvg MAXLOADAVG
59*27162e4eSAndroid Build Coastguard Worker                        maximum load average to start testing
60*27162e4eSAndroid Build Coastguard Worker  --lastCLevel LASTCLEVEL
61*27162e4eSAndroid Build Coastguard Worker                        last compression level for testing
62*27162e4eSAndroid Build Coastguard Worker  --sleepTime SLEEPTIME
63*27162e4eSAndroid Build Coastguard Worker                        frequency of repository checking in seconds
64*27162e4eSAndroid Build Coastguard Worker```
65*27162e4eSAndroid Build Coastguard Worker
66*27162e4eSAndroid Build Coastguard Worker
67*27162e4eSAndroid Build Coastguard Worker#### License
68*27162e4eSAndroid Build Coastguard Worker
69*27162e4eSAndroid Build Coastguard WorkerAll files in this directory are licensed under GPL-v2.
70*27162e4eSAndroid Build Coastguard WorkerSee [COPYING](COPYING) for details.
71*27162e4eSAndroid Build Coastguard WorkerThe text of the license is also included at the top of each source file.
72