All Projects → MozillaSecurity → Lithium

MozillaSecurity / Lithium

Licence: mpl-2.0
Line-based testcase reducer

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Lithium

reducer-tester
Utilities for testing redux reducers
Stars: ✭ 19 (-76.25%)
Mutual labels:  reducer
Immer
Create the next immutable state by mutating the current one
Stars: ✭ 21,756 (+27095%)
Mutual labels:  reducer
Puddles
Tiny vdom app framework. Pure Redux. No boilerplate.
Stars: ✭ 24 (-70%)
Mutual labels:  reducer
pquery
pquery is an open-source (GPLv2 licensed) multi-threaded test program, written in C++, created to stress test the MySQL server (in any flavor), either randomly or sequentially, for QA purposes.
Stars: ✭ 48 (-40%)
Mutual labels:  reducer
Swiftrex
Swift + Redux + (Combine|RxSwift|ReactiveSwift) -> SwiftRex
Stars: ✭ 267 (+233.75%)
Mutual labels:  reducer
Repatch
Dispatch reducers
Stars: ✭ 516 (+545%)
Mutual labels:  reducer
cra-redux-boilerplate
⚛️🔨create-react-app application with redux and another cool libraries to make your life easier.
Stars: ✭ 15 (-81.25%)
Mutual labels:  reducer
Use Reducer X
🔩 An alternative to useReducer that accepts middlewares.
Stars: ✭ 62 (-22.5%)
Mutual labels:  reducer
Redux Machine
A tiny library (12 lines) for creating state machines in Redux apps
Stars: ✭ 338 (+322.5%)
Mutual labels:  reducer
Async Reduce
Reducer for similar simultaneously coroutines
Stars: ✭ 17 (-78.75%)
Mutual labels:  reducer
percona-qa
Percona QA is a suite of scripts and utilities that assists in building, continuous integration, automated testing & bug reporting for Percona Server, Percona XtraDB Cluster, Percona XtraBackup, Percona Server for MongoDB, as well as other flavors of MySQL (Oracle, Facebook MyQSL, WebScaleSQL, MariaDB) etc.
Stars: ✭ 55 (-31.25%)
Mutual labels:  reducer
Redux Orm
A small, simple and immutable ORM to manage relational data in your Redux store.
Stars: ✭ 2,922 (+3552.5%)
Mutual labels:  reducer
Redux Ecosystem Links
A categorized list of Redux-related addons, libraries, and utilities
Stars: ✭ 5,076 (+6245%)
Mutual labels:  reducer
k-redux-factory
Factory of Redux reducers and their associated actions and selectors.
Stars: ✭ 18 (-77.5%)
Mutual labels:  reducer
Redux Dynamic Modules
Modularize Redux by dynamically loading reducers and middlewares.
Stars: ✭ 874 (+992.5%)
Mutual labels:  reducer
react-stateful-component
Functional stateful React components with sideEffect support
Stars: ✭ 19 (-76.25%)
Mutual labels:  reducer
Reductor
Redux for Android. Predictable state container library for Java/Android
Stars: ✭ 460 (+475%)
Mutual labels:  reducer
Use Reducer With Side Effects
Stars: ✭ 75 (-6.25%)
Mutual labels:  reducer
Reapex
A lightweight framework to build pluggable and extendable redux/react application
Stars: ✭ 58 (-27.5%)
Mutual labels:  reducer
Useeffectreducer
useReducer + useEffect = useEffectReducer
Stars: ✭ 642 (+702.5%)
Mutual labels:  reducer

Task Status codecov Matrix PyPI

Using Lithium

Lithium is an automated testcase reduction tool developed by Jesse Ruderman.

Most of what you need to know to use Lithium is in one of these pages:

Lithium's algorithm

By default, Lithium uses a clever algorithm that's efficient at reducing most large testcases. For a testcase with 2048 lines, it will try removing each chunk of size 1024, permanently removing it if it is still 'interesting'. It then does the same for each chunk of size 512, then 256, all the way down to chunks of size 1. It then does as many additional rounds at chunk size 1 as necessary until it completes a round without removing anything, at which point the file is 1-minimal (removing any single line from the file makes it 'uninteresting').

If n is the size of the testcase and m is the size of the 1-minimal testcase found by Lithium, then Lithium usually performs O(m ⋅ lg(n)) tests with a total test size of O(m ⋅ n). See the analysis of Lithium's algorithm for more information and proofs.

To keep m small, make sure Lithium's smallest removals won't introduce fatal syntax errors into the file it is trying to reduce. For example, don't use --char when trying to reduce a long sequence of JavaScript statements, and don't feed XHTML to Lithium. (Convert it to HTML first and let Firefox's tag-soup parser sort out the invalidity, or use serializeDOMAsScript.)

Command line syntax

pip install lithium-reducer
python -m lithium [options] interestingness-test.py [arguments for interestingness test]

Command line options

--testcase=filename
Tells Lithium which file to reduce. By default, it will assume the last argument to the interestingness test is the file to reduce.
--char (-c)
By default, Lithium treats lines as atomic units. This is great if each line is a JavaScript statement, but sometimes you want to go further. Use this option to tell Lithium to treat the file as a sequence of characters instead of a sequence of lines.
--strategy=[check-only,minimize,minimize-balanced,replace-properties-by-globals,replace-arguments-by-globals,minimize-around]
"minimize" is the default, the algorithm described above. "check-only" tries to run Lithium to determine interestingness, without reduction. For the other strategies, check out this GitHub PR.
--repeat=[always, last, never].
By default, Lithium only repeats at the same chunk size if it just finished the last round (e.g. chunk size 1). You can use --repeat=always to tell it to repeat any chunk size if something was removed during the round, which can be useful for non-deterministic testcases or non-monotonic situations. You can use --repeat=never to tell it to exit immediately after a single round at the last chunk size, which can save a little time at the risk of leaving a little bit extra in the file.
--max=n. default: about half of the file.
--min=n. default: 1.
What chunk sizes to test. Must be powers of two. --max is useful if you're restarting Lithium after it has already gone through a few rounds. --min is useful if you're reducing HTML and want to do the final by hand.
--chunk-size=n
Shortcut for "repeat=never, min=n, max=n". --chunk-size=1 is a quick way to determine whether a file is 1-minimal, for example after making a change that you think might make some lines unnecessary.

Hints

If you find a non-deterministic bug, don't despair. Lithium will do fine as long as you make the bug happen at least 70% of the time. You can repeat the test either within the application, by adding a loop or reload in the testcase (outside of the DDBEGIN/DDEND markers!), or outside of the application, by adding a loop to the "interestingness test" script.

Requirements

Lithium is written in Python and requires Python 3.5+.

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].