1
0
Fork 0
mirror of https://github.com/linux-usb-gadgets/libusbgx.git synced 2025-07-25 22:35:06 +03:00
Commit graph

24 commits

Author SHA1 Message Date
Pawel Szewczyk
d17722045a libusbgx: tests: Add config attributes getting and setting test
Change-Id: I86e5263e11f3794aa1b999f02778dbf6ce32e572
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:35 +01:00
Pawel Szewczyk
9ba53ec609 libusbgx: tests: Add getting and setting config strs test
Change-Id: I1c7beaf82e1df526dcd01d13c7d7857d4652fdd7
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:35 +01:00
Pawel Szewczyk
78e83b64ad libusbgx: tests: Add getting binding test
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>

Fix coding style.

Change-Id: I1ae18bc2393067cd0735ab812ec720e900ef3161
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:35 +01:00
Krzysztof Opasiak
03606d9238 libusbgx: tests: Make a deep copy of date for each test case
Each test case should use own copy of test_* structures.
To achieve this we do a deep copy of structures which has
not been marked as writable.

Change-Id: I1f1a949059dd1a41d4a9f80ca27c391533a59a7f
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
2015-12-22 21:45:34 +01:00
Krzysztof Opasiak
64ef96ef91 libusbgx: tests: Add writable attribute to test_* structures
Reusing the same structures for many tests is wrong for
security reasons. Some of test cases already allocates
own copy of test structures. This commit adds a field
which indicates if given structure has been allocated
for test case or if it is global structure and should
not be changed.

Change-Id: I8a1f9b9059dd1a41d4a9f80c427c991533f7ab9a
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Reviewed-by: Pawel Szewczyk <p.szewczyk@samsung.com>
2015-12-22 21:45:34 +01:00
Pawel Szewczyk
3e80a0fec6 libusbgx: tests: Add test_binding structure
Using the same type for binding and function (and assuming that binding
has the same name as its target function) was not an elegant solution.
It is fixed by adding separate structure and use it in test setups.

To save old, convinient way of defining bindings by list of functions,
additional field in test binding is provided and prepare_state generate
bindings based on it.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>

s/binded/bound

Change-Id: I8a1f9b9059dd1a41d4a9f80c427c991533a74b7e
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Pawel Szewczyk
2209249876 libusbgx: tests: Add getting gadget string test
Change-Id: I78ab01d1ca8ff5105448d3bbf3982753cdfc01d6
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Pawel Szewczyk
2060c87f13 libusbgx: tests: Add setting gadget strs tests
Change-Id: Ia7975f0a3a2e8e2bc6bff8bcd64430a6e26d1888
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Krzysztof Opasiak
a7d8b8739e libusbgx: tests: Try to iterate over all gadget attributes
Change-Id: I0fa869ecf50ead08171ee1da4b7a5326694efbdc
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Pawel Szewczyk
8df248e8b6 libusbgx: tests: Test getting strings of gadget attributes
Simply check if valid strings are returned

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>

Use USBG_GADGET_ATTR_MIN - 1 instead of just -1.

Change-Id: I0f3869eaf50ead08171ee1da4b7a5326694efb2c
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Pawel Szewczyk
895d7cef49 libusbgx: tests: Add udc tests
Change-Id: I9725395ff5a6bac7f4edfdaa4da9bbce3a3186ff
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Pawel Szewczyk
623f89071c libusbgx: tests: Add states with long strings
Change-Id: I92c185449293fd9426f151687832b3bdb0c57572
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Pawel Szewczyk
aaebacf25e libusbgx: tests: Add gadget attrs get/set tests
Change-Id: I5ab4262a5532e07de9e6e919e6dde5dd49da4702
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Pawel Szewczyk
a9e608e101 libusbgx: tests: Add getting config tests
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>

Remove unused variable in for_each_test_config().

Change-Id: I6dd8dc33639dff2d3322c6098a43c69beb8a7ef6
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Pawel Szewczyk
7115cced5b libusbgx: tests: Add getting configfs path test
Change-Id: Ia7d368c8749d28235a4209d5a0de90dc6878717b
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Pawel Szewczyk
30dfcc89fa libusbgx: tests: Add getting functions tests
Change-Id: I89296562177061559de84aa5332d8dc9347d2e13
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Pawel Szewczyk
be767ffc0f libusbgx: tests: Make some functions static, some move to header
init_with_state is also used by functions in usbg-test.c, so was declared
globaly in header. Other functions from test.c is not used outside and
we can make them static.

Change-Id: I56f4095dd8f98c8349d02b421f02de1d61e0b2b7
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:34 +01:00
Krzysztof Opasiak
3133e4c2d3 libusbgx: tests: Add doxygen macros for documenting test cases
Also proceed doxygen config file with autoconf now. Autoconf copy .in file,
substituting found variable values. It allows to specify what documentation
should be build by configure script.

Change-Id: I00cae61aefcc5b6444b0afc0dfe73c5973de34a9
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Rebase and update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:33 +01:00
Krzysztof Opasiak
6dbd9775a8 libusbgx: tests: Build tests with autotools
Change-Id: I1438caf6806d2197bcf20a63b56e33d9243fb2a0
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Update description and rebase]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:29 +01:00
Krzysztof Opasiak
c3c2223d44 libusbgx: tests: Fix tests to use correct usbg_state field
Due to recent changes in usbg_state, lets
introduce configfs_path field in state test_state
structure and fill it.

Since now path field should not be filled as it's
filled by prepare_state() function and generates
subsystem path using given configfs path.

Change-Id: I50e606c9f8c5eb478ac48fc453840b9a3efdd117
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:29 +01:00
Krzysztof Opasiak
aaae83f680 libusbgx: tests: Fix tests build
Due to adding configure flags which allows to disable
libconfig dependency introduce a temporary fix which should
be removed when we will build tests with autotools.

Change-Id: I51f606c9f8c5eb478ac48fc453840b9a3efdd117
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:45:29 +01:00
Pawel Szewczyk
773a80429c libusbgx: tests: Remove negative buffer test
Size_t is unsigned and passing -1 as buffer length makes no sense.

Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
[Rebase and update description]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:44:57 +01:00
Krzysztof Opasiak
5b4eb3c5de libusbgx: tests: Allow to skip some tests
In some cases we may want to mark some tests as skipped.
Doing this in code requires recompilation after each change.
This patch extends the tests framework and allows to create
configuration file and mark some tests as skipped (for example
using # and comment some test and run them always from the
same binary file.

We use stdin/stdout for reading/writing configuration
because we are wrapping filesystem operations in our
mock framework (usbg-io-wrappers). To keep our mock
framework as simple as we can we use those standard
streams which are forrwarded by framework to original
implementations of those functions.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:43:24 +01:00
Pawel Szewczyk
4628580af9 libusbgx: tests: Add init and getting gadgets tests
Change-Id: I4c872a76bf59b8eaababfdf4bbb1804d4008f8de
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>

Make two macros (generic and specific) for defining test
cases instead of hardcoding everything in one macro.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2015-12-22 21:41:58 +01:00