1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2018, STMicroelectronics
12 static int dm_test_serial(struct unit_test_state *uts)
14 struct udevice *dev_serial;
16 ut_assertok(uclass_get_device_by_name(UCLASS_SERIAL, "serial",
19 ut_assertok(serial_tstc());
21 * test with default config which is the only one supported by
22 * sandbox_serial driver
24 ut_assertok(serial_setconfig(SERIAL_DEFAULT_CONFIG));
26 * test with a serial config which is not supported by
27 * sandbox_serial driver: test with wrong parity
29 ut_asserteq(-ENOTSUPP,
30 serial_setconfig(SERIAL_CONFIG(SERIAL_PAR_ODD,
34 * test with a serial config which is not supported by
35 * sandbox_serial driver: test with wrong bits number
37 ut_asserteq(-ENOTSUPP,
38 serial_setconfig(SERIAL_CONFIG(SERIAL_PAR_NONE,
43 * test with a serial config which is not supported by
44 * sandbox_serial driver: test with wrong stop bits number
46 ut_asserteq(-ENOTSUPP,
47 serial_setconfig(SERIAL_CONFIG(SERIAL_PAR_NONE,
54 DM_TEST(dm_test_serial, DM_TESTF_SCAN_FDT);