@@ -50,6 +50,79 @@ sdb> addr modules | lxlist "struct module" list | member name ! sort | head -n 3
50
50
(char [56])"async_pq"
51
51
```
52
52
53
- ### Resources
53
+ ### Developer Testing
54
54
55
- User and developer resources for sdb can be found in the [ project's wiki] ( https://github.com/delphix/sdb/wiki ) .
55
+ #### Linting
56
+
57
+ ```
58
+ $ python3 -m pip install pylint pytest
59
+ $ python3 -m pylint -d duplicate-code -d invalid-name sdb
60
+ $ python3 -m pylint -d duplicate-code -d invalid-name tests
61
+ ```
62
+
63
+ #### Type Checking
64
+
65
+ ```
66
+ $ python3 -m pip install mypy==0.730
67
+ $ python3 -m mypy --strict --show-error-codes -p sdb
68
+ $ python3 -m mypy --strict --ignore-missing-imports --show-error-codes -p tests
69
+ ```
70
+
71
+ #### Style Checks
72
+
73
+ ```
74
+ $ python3 -m pip install yapf
75
+ $ python3 -m yapf --diff --style google --recursive sdb
76
+ $ python3 -m yapf --diff --style google --recursive tests
77
+ ```
78
+
79
+ If ` yapf ` has suggestions you can apply them automatically by substituting
80
+ ` --diff ` with ` -i ` like this:
81
+ ```
82
+ $ python3 -m yapf -i --style google --recursive sdb
83
+ $ python3 -m yapf -i --style google --recursive tests
84
+ ```
85
+
86
+ #### Regression Testing
87
+
88
+ Regression testing is currently done by downloading a refererence crash/core
89
+ dump and running a predetermined set of commads on it, ensuring that they
90
+ return the same reference output before and after your changes. To see the list
91
+ of reference crash dumps refer to the testing matrix of the ` pytest ` Github
92
+ action in ` .github/workflows/main.yml ` . Here is an example of running the
93
+ regression test commands against ` dump.201912060006.tar.lzma ` with code
94
+ coverage and verbose output:
95
+
96
+ ```
97
+ $ python3 -m pip install python-config pytest pytest-cov
98
+ $ .github/scripts/download-dump-from-s3.sh dump.201912060006.tar.lzma
99
+ $ python3 -m pytest -v --cov sdb --cov-report xml tests
100
+ ```
101
+
102
+ If you want ` pytest ` to stop on the first failure it encounters add
103
+ ` -x/--exitfirst ` in the command above.
104
+
105
+ If you've added new test commands or found mistakes in the current reference
106
+ output and you want (re)generate reference output for a crash dump - let's say
107
+ ` dump.201912060006 ` from above:
108
+ ```
109
+ $ PYTHONPATH=$(pwd) python3 tests/integration/gen_regression_output.py dump.201912060006
110
+ ```
111
+
112
+ or more generically:
113
+ ```
114
+ $ PYTHONPATH=$(pwd) python3 tests/integration/gen_regression_output.py <dump name>
115
+ ```
116
+
117
+ For the time being, the test suite is not smart enought to handle the testing
118
+ of multiple crash dumps at the same time. Until that happens, developers that
119
+ want to test multiple crash dumps need to delete their current crash dump
120
+ before downloading the next to run ` pytest ` . Here is a sequence of commands to
121
+ run ` pytest ` against two crash dumps:
122
+ ```
123
+ $ .github/scripts/download-dump-from-s3.sh dump.201912060006.tar.lzma
124
+ $ python3 -m pytest -v --cov sdb --cov-report xml tests
125
+ $ .github/scripts/clear-dump.sh
126
+ $ .github/scripts/download-dump-from-s3.sh dump.202303131823.tar.gz
127
+ $ python3 -m pytest -v --cov sdb --cov-report xml tests
128
+ ```
0 commit comments