Hi Arpitha, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on ext4/dev] [also build test WARNING on linus/master v5.9 next-20201023] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Arpitha-Raghunandan/kunit-Support-for-Parameterized-Testing/20201023-230827 base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev config: arm64-randconfig-r026-20201023 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 147b9497e79a98a8614b2b5eb4ba653b44f6b6f0) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/0day-ci/linux/commit/2c09a7974ce3b438845bfafb539513dc91c021b4 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Arpitha-Raghunandan/kunit-Support-for-Parameterized-Testing/20201023-230827 git checkout 2c09a7974ce3b438845bfafb539513dc91c021b4 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> All warnings (new ones prefixed by >>): In file included from lib/kunit/test.c:9: >> include/kunit/test.h:1732:2: warning: comparison of distinct pointer types ('typeof (__left) *' (aka 'unsigned long *') and 'typeof (__right) *' (aka 'int *')) [-Wcompare-distinct-pointer-types] KUNIT_ASSERT_EQ(test, (prev_param - param_array) % type_size, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1494:2: note: expanded from macro 'KUNIT_ASSERT_EQ' KUNIT_BINARY_EQ_ASSERTION(test, KUNIT_ASSERTION, left, right) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:843:2: note: expanded from macro 'KUNIT_BINARY_EQ_ASSERTION' KUNIT_BINARY_EQ_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:833:2: note: expanded from macro 'KUNIT_BINARY_EQ_MSG_ASSERTION' KUNIT_BASE_EQ_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:744:2: note: expanded from macro 'KUNIT_BASE_EQ_MSG_ASSERTION' KUNIT_BASE_BINARY_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:720:9: note: expanded from macro 'KUNIT_BASE_BINARY_ASSERTION' ((void)__typecheck(__left, __right)); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/kernel.h:850:29: note: expanded from macro '__typecheck' (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ In file included from lib/kunit/test.c:9: >> include/kunit/test.h:1737:2: warning: incompatible pointer to integer conversion initializing 'long long' with an expression of type 'typeof (prev_param)' (aka 'void *') [-Wint-conversion] KUNIT_ASSERT_GE(test, prev_param, param_array); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1644:2: note: expanded from macro 'KUNIT_ASSERT_GE' KUNIT_BINARY_GE_ASSERTION(test, KUNIT_ASSERTION, left, right) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1038:2: note: expanded from macro 'KUNIT_BINARY_GE_ASSERTION' KUNIT_BINARY_GE_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1028:2: note: expanded from macro 'KUNIT_BINARY_GE_MSG_ASSERTION' KUNIT_BASE_GE_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/kunit/test.h:729:8: note: expanded from macro 'KUNIT_BASE_BINARY_ASSERTION' __left, \ ^~~~~~ include/kunit/assert.h:238:16: note: expanded from macro 'KUNIT_INIT_BINARY_ASSERT_STRUCT' .left_value = left_val, \ ^~~~~~~~ include/kunit/test.h:622:36: note: expanded from macro 'KUNIT_ASSERTION' struct assert_class __assertion = INITIALIZER; \ ^~~~~~~~~~~ >> include/kunit/test.h:1737:2: warning: incompatible pointer to integer conversion initializing 'long long' with an expression of type 'typeof (param_array)' (aka 'void *') [-Wint-conversion] KUNIT_ASSERT_GE(test, prev_param, param_array); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1644:2: note: expanded from macro 'KUNIT_ASSERT_GE' KUNIT_BINARY_GE_ASSERTION(test, KUNIT_ASSERTION, left, right) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1038:2: note: expanded from macro 'KUNIT_BINARY_GE_ASSERTION' KUNIT_BINARY_GE_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1028:2: note: expanded from macro 'KUNIT_BINARY_GE_MSG_ASSERTION' KUNIT_BASE_GE_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/kunit/test.h:731:8: note: expanded from macro 'KUNIT_BASE_BINARY_ASSERTION' __right), \ ^~~~~~~ include/kunit/assert.h:240:17: note: expanded from macro 'KUNIT_INIT_BINARY_ASSERT_STRUCT' .right_value = right_val \ ^~~~~~~~~ include/kunit/test.h:622:36: note: expanded from macro 'KUNIT_ASSERTION' struct assert_class __assertion = INITIALIZER; \ ^~~~~~~~~~~ 3 warnings generated. -- In file included from lib/kunit/debugfs.c:10: >> include/kunit/test.h:1732:2: warning: comparison of distinct pointer types ('typeof (__left) *' (aka 'unsigned long *') and 'typeof (__right) *' (aka 'int *')) [-Wcompare-distinct-pointer-types] KUNIT_ASSERT_EQ(test, (prev_param - param_array) % type_size, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1494:2: note: expanded from macro 'KUNIT_ASSERT_EQ' KUNIT_BINARY_EQ_ASSERTION(test, KUNIT_ASSERTION, left, right) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:843:2: note: expanded from macro 'KUNIT_BINARY_EQ_ASSERTION' KUNIT_BINARY_EQ_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:833:2: note: expanded from macro 'KUNIT_BINARY_EQ_MSG_ASSERTION' KUNIT_BASE_EQ_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:744:2: note: expanded from macro 'KUNIT_BASE_EQ_MSG_ASSERTION' KUNIT_BASE_BINARY_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:720:9: note: expanded from macro 'KUNIT_BASE_BINARY_ASSERTION' ((void)__typecheck(__left, __right)); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/kernel.h:850:29: note: expanded from macro '__typecheck' (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ In file included from lib/kunit/debugfs.c:10: >> include/kunit/test.h:1737:2: warning: incompatible pointer to integer conversion initializing 'long long' with an expression of type 'typeof (prev_param)' (aka 'void *') [-Wint-conversion] KUNIT_ASSERT_GE(test, prev_param, param_array); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1644:2: note: expanded from macro 'KUNIT_ASSERT_GE' KUNIT_BINARY_GE_ASSERTION(test, KUNIT_ASSERTION, left, right) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1038:2: note: expanded from macro 'KUNIT_BINARY_GE_ASSERTION' KUNIT_BINARY_GE_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1028:2: note: expanded from macro 'KUNIT_BINARY_GE_MSG_ASSERTION' KUNIT_BASE_GE_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/kunit/test.h:729:8: note: expanded from macro 'KUNIT_BASE_BINARY_ASSERTION' __left, \ ^~~~~~ include/kunit/assert.h:238:16: note: expanded from macro 'KUNIT_INIT_BINARY_ASSERT_STRUCT' .left_value = left_val, \ ^~~~~~~~ include/kunit/test.h:622:36: note: expanded from macro 'KUNIT_ASSERTION' struct assert_class __assertion = INITIALIZER; \ ^~~~~~~~~~~ >> include/kunit/test.h:1737:2: warning: incompatible pointer to integer conversion initializing 'long long' with an expression of type 'typeof (param_array)' (aka 'void *') [-Wint-conversion] KUNIT_ASSERT_GE(test, prev_param, param_array); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1644:2: note: expanded from macro 'KUNIT_ASSERT_GE' KUNIT_BINARY_GE_ASSERTION(test, KUNIT_ASSERTION, left, right) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1038:2: note: expanded from macro 'KUNIT_BINARY_GE_ASSERTION' KUNIT_BINARY_GE_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/kunit/test.h:1028:2: note: expanded from macro 'KUNIT_BINARY_GE_MSG_ASSERTION' KUNIT_BASE_GE_MSG_ASSERTION(test, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) include/kunit/test.h:731:8: note: expanded from macro 'KUNIT_BASE_BINARY_ASSERTION' __right), \ ^~~~~~~ include/kunit/assert.h:240:17: note: expanded from macro 'KUNIT_INIT_BINARY_ASSERT_STRUCT' .right_value = right_val \ ^~~~~~~~~ include/kunit/test.h:622:36: note: expanded from macro 'KUNIT_ASSERTION' struct assert_class __assertion = INITIALIZER; \ ^~~~~~~~~~~ lib/kunit/debugfs.c:28:6: warning: no previous prototype for function 'kunit_debugfs_cleanup' [-Wmissing-prototypes] void kunit_debugfs_cleanup(void) ^ lib/kunit/debugfs.c:28:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void kunit_debugfs_cleanup(void) ^ static lib/kunit/debugfs.c:33:6: warning: no previous prototype for function 'kunit_debugfs_init' [-Wmissing-prototypes] void kunit_debugfs_init(void) ^ lib/kunit/debugfs.c:33:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void kunit_debugfs_init(void) ^ static lib/kunit/debugfs.c:92:6: warning: no previous prototype for function 'kunit_debugfs_create_suite' [-Wmissing-prototypes] void kunit_debugfs_create_suite(struct kunit_suite *suite) ^ lib/kunit/debugfs.c:92:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void kunit_debugfs_create_suite(struct kunit_suite *suite) ^ static lib/kunit/debugfs.c:108:6: warning: no previous prototype for function 'kunit_debugfs_destroy_suite' [-Wmissing-prototypes] void kunit_debugfs_destroy_suite(struct kunit_suite *suite) ^ lib/kunit/debugfs.c:108:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void kunit_debugfs_destroy_suite(struct kunit_suite *suite) ^ static 7 warnings generated. vim +1732 include/kunit/test.h 1147 1148 #define KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION(test, assert_type, ptr) \ 1149 KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test, \ 1150 assert_type, \ 1151 ptr, \ 1152 NULL) 1153 1154 /** 1155 * KUNIT_EXPECT_TRUE() - Causes a test failure when the expression is not true. 1156 * @test: The test context object. 1157 * @condition: an arbitrary boolean expression. The test fails when this does 1158 * not evaluate to true. 1159 * 1160 * This and expectations of the form `KUNIT_EXPECT_*` will cause the test case 1161 * to fail when the specified condition is not met; however, it will not prevent 1162 * the test case from continuing to run; this is otherwise known as an 1163 * *expectation failure*. 1164 */ 1165 #define KUNIT_EXPECT_TRUE(test, condition) \ 1166 KUNIT_TRUE_ASSERTION(test, KUNIT_EXPECTATION, condition) 1167 1168 #define KUNIT_EXPECT_TRUE_MSG(test, condition, fmt, ...) \ 1169 KUNIT_TRUE_MSG_ASSERTION(test, \ 1170 KUNIT_EXPECTATION, \ 1171 condition, \ 1172 fmt, \ 1173 ##__VA_ARGS__) 1174 1175 /** 1176 * KUNIT_EXPECT_FALSE() - Makes a test failure when the expression is not false. 1177 * @test: The test context object. 1178 * @condition: an arbitrary boolean expression. The test fails when this does 1179 * not evaluate to false. 1180 * 1181 * Sets an expectation that @condition evaluates to false. See 1182 * KUNIT_EXPECT_TRUE() for more information. 1183 */ 1184 #define KUNIT_EXPECT_FALSE(test, condition) \ 1185 KUNIT_FALSE_ASSERTION(test, KUNIT_EXPECTATION, condition) 1186 1187 #define KUNIT_EXPECT_FALSE_MSG(test, condition, fmt, ...) \ 1188 KUNIT_FALSE_MSG_ASSERTION(test, \ 1189 KUNIT_EXPECTATION, \ 1190 condition, \ 1191 fmt, \ 1192 ##__VA_ARGS__) 1193 1194 /** 1195 * KUNIT_EXPECT_EQ() - Sets an expectation that @left and @right are equal. 1196 * @test: The test context object. 1197 * @left: an arbitrary expression that evaluates to a primitive C type. 1198 * @right: an arbitrary expression that evaluates to a primitive C type. 1199 * 1200 * Sets an expectation that the values that @left and @right evaluate to are 1201 * equal. This is semantically equivalent to 1202 * KUNIT_EXPECT_TRUE(@test, (@left) == (@right)). See KUNIT_EXPECT_TRUE() for 1203 * more information. 1204 */ 1205 #define KUNIT_EXPECT_EQ(test, left, right) \ 1206 KUNIT_BINARY_EQ_ASSERTION(test, KUNIT_EXPECTATION, left, right) 1207 1208 #define KUNIT_EXPECT_EQ_MSG(test, left, right, fmt, ...) \ 1209 KUNIT_BINARY_EQ_MSG_ASSERTION(test, \ 1210 KUNIT_EXPECTATION, \ 1211 left, \ 1212 right, \ 1213 fmt, \ 1214 ##__VA_ARGS__) 1215 1216 /** 1217 * KUNIT_EXPECT_PTR_EQ() - Expects that pointers @left and @right are equal. 1218 * @test: The test context object. 1219 * @left: an arbitrary expression that evaluates to a pointer. 1220 * @right: an arbitrary expression that evaluates to a pointer. 1221 * 1222 * Sets an expectation that the values that @left and @right evaluate to are 1223 * equal. This is semantically equivalent to 1224 * KUNIT_EXPECT_TRUE(@test, (@left) == (@right)). See KUNIT_EXPECT_TRUE() for 1225 * more information. 1226 */ 1227 #define KUNIT_EXPECT_PTR_EQ(test, left, right) \ 1228 KUNIT_BINARY_PTR_EQ_ASSERTION(test, \ 1229 KUNIT_EXPECTATION, \ 1230 left, \ 1231 right) 1232 1233 #define KUNIT_EXPECT_PTR_EQ_MSG(test, left, right, fmt, ...) \ 1234 KUNIT_BINARY_PTR_EQ_MSG_ASSERTION(test, \ 1235 KUNIT_EXPECTATION, \ 1236 left, \ 1237 right, \ 1238 fmt, \ 1239 ##__VA_ARGS__) 1240 1241 /** 1242 * KUNIT_EXPECT_NE() - An expectation that @left and @right are not equal. 1243 * @test: The test context object. 1244 * @left: an arbitrary expression that evaluates to a primitive C type. 1245 * @right: an arbitrary expression that evaluates to a primitive C type. 1246 * 1247 * Sets an expectation that the values that @left and @right evaluate to are not 1248 * equal. This is semantically equivalent to 1249 * KUNIT_EXPECT_TRUE(@test, (@left) != (@right)). See KUNIT_EXPECT_TRUE() for 1250 * more information. 1251 */ 1252 #define KUNIT_EXPECT_NE(test, left, right) \ 1253 KUNIT_BINARY_NE_ASSERTION(test, KUNIT_EXPECTATION, left, right) 1254 1255 #define KUNIT_EXPECT_NE_MSG(test, left, right, fmt, ...) \ 1256 KUNIT_BINARY_NE_MSG_ASSERTION(test, \ 1257 KUNIT_EXPECTATION, \ 1258 left, \ 1259 right, \ 1260 fmt, \ 1261 ##__VA_ARGS__) 1262 1263 /** 1264 * KUNIT_EXPECT_PTR_NE() - Expects that pointers @left and @right are not equal. 1265 * @test: The test context object. 1266 * @left: an arbitrary expression that evaluates to a pointer. 1267 * @right: an arbitrary expression that evaluates to a pointer. 1268 * 1269 * Sets an expectation that the values that @left and @right evaluate to are not 1270 * equal. This is semantically equivalent to 1271 * KUNIT_EXPECT_TRUE(@test, (@left) != (@right)). See KUNIT_EXPECT_TRUE() for 1272 * more information. 1273 */ 1274 #define KUNIT_EXPECT_PTR_NE(test, left, right) \ 1275 KUNIT_BINARY_PTR_NE_ASSERTION(test, \ 1276 KUNIT_EXPECTATION, \ 1277 left, \ 1278 right) 1279 1280 #define KUNIT_EXPECT_PTR_NE_MSG(test, left, right, fmt, ...) \ 1281 KUNIT_BINARY_PTR_NE_MSG_ASSERTION(test, \ 1282 KUNIT_EXPECTATION, \ 1283 left, \ 1284 right, \ 1285 fmt, \ 1286 ##__VA_ARGS__) 1287 1288 /** 1289 * KUNIT_EXPECT_LT() - An expectation that @left is less than @right. 1290 * @test: The test context object. 1291 * @left: an arbitrary expression that evaluates to a primitive C type. 1292 * @right: an arbitrary expression that evaluates to a primitive C type. 1293 * 1294 * Sets an expectation that the value that @left evaluates to is less than the 1295 * value that @right evaluates to. This is semantically equivalent to 1296 * KUNIT_EXPECT_TRUE(@test, (@left) < (@right)). See KUNIT_EXPECT_TRUE() for 1297 * more information. 1298 */ 1299 #define KUNIT_EXPECT_LT(test, left, right) \ 1300 KUNIT_BINARY_LT_ASSERTION(test, KUNIT_EXPECTATION, left, right) 1301 1302 #define KUNIT_EXPECT_LT_MSG(test, left, right, fmt, ...) \ 1303 KUNIT_BINARY_LT_MSG_ASSERTION(test, \ 1304 KUNIT_EXPECTATION, \ 1305 left, \ 1306 right, \ 1307 fmt, \ 1308 ##__VA_ARGS__) 1309 1310 /** 1311 * KUNIT_EXPECT_LE() - Expects that @left is less than or equal to @right. 1312 * @test: The test context object. 1313 * @left: an arbitrary expression that evaluates to a primitive C type. 1314 * @right: an arbitrary expression that evaluates to a primitive C type. 1315 * 1316 * Sets an expectation that the value that @left evaluates to is less than or 1317 * equal to the value that @right evaluates to. Semantically this is equivalent 1318 * to KUNIT_EXPECT_TRUE(@test, (@left) <= (@right)). See KUNIT_EXPECT_TRUE() for 1319 * more information. 1320 */ 1321 #define KUNIT_EXPECT_LE(test, left, right) \ 1322 KUNIT_BINARY_LE_ASSERTION(test, KUNIT_EXPECTATION, left, right) 1323 1324 #define KUNIT_EXPECT_LE_MSG(test, left, right, fmt, ...) \ 1325 KUNIT_BINARY_LE_MSG_ASSERTION(test, \ 1326 KUNIT_EXPECTATION, \ 1327 left, \ 1328 right, \ 1329 fmt, \ 1330 ##__VA_ARGS__) 1331 1332 /** 1333 * KUNIT_EXPECT_GT() - An expectation that @left is greater than @right. 1334 * @test: The test context object. 1335 * @left: an arbitrary expression that evaluates to a primitive C type. 1336 * @right: an arbitrary expression that evaluates to a primitive C type. 1337 * 1338 * Sets an expectation that the value that @left evaluates to is greater than 1339 * the value that @right evaluates to. This is semantically equivalent to 1340 * KUNIT_EXPECT_TRUE(@test, (@left) > (@right)). See KUNIT_EXPECT_TRUE() for 1341 * more information. 1342 */ 1343 #define KUNIT_EXPECT_GT(test, left, right) \ 1344 KUNIT_BINARY_GT_ASSERTION(test, KUNIT_EXPECTATION, left, right) 1345 1346 #define KUNIT_EXPECT_GT_MSG(test, left, right, fmt, ...) \ 1347 KUNIT_BINARY_GT_MSG_ASSERTION(test, \ 1348 KUNIT_EXPECTATION, \ 1349 left, \ 1350 right, \ 1351 fmt, \ 1352 ##__VA_ARGS__) 1353 1354 /** 1355 * KUNIT_EXPECT_GE() - Expects that @left is greater than or equal to @right. 1356 * @test: The test context object. 1357 * @left: an arbitrary expression that evaluates to a primitive C type. 1358 * @right: an arbitrary expression that evaluates to a primitive C type. 1359 * 1360 * Sets an expectation that the value that @left evaluates to is greater than 1361 * the value that @right evaluates to. This is semantically equivalent to 1362 * KUNIT_EXPECT_TRUE(@test, (@left) >= (@right)). See KUNIT_EXPECT_TRUE() for 1363 * more information. 1364 */ 1365 #define KUNIT_EXPECT_GE(test, left, right) \ 1366 KUNIT_BINARY_GE_ASSERTION(test, KUNIT_EXPECTATION, left, right) 1367 1368 #define KUNIT_EXPECT_GE_MSG(test, left, right, fmt, ...) \ 1369 KUNIT_BINARY_GE_MSG_ASSERTION(test, \ 1370 KUNIT_EXPECTATION, \ 1371 left, \ 1372 right, \ 1373 fmt, \ 1374 ##__VA_ARGS__) 1375 1376 /** 1377 * KUNIT_EXPECT_STREQ() - Expects that strings @left and @right are equal. 1378 * @test: The test context object. 1379 * @left: an arbitrary expression that evaluates to a null terminated string. 1380 * @right: an arbitrary expression that evaluates to a null terminated string. 1381 * 1382 * Sets an expectation that the values that @left and @right evaluate to are 1383 * equal. This is semantically equivalent to 1384 * KUNIT_EXPECT_TRUE(@test, !strcmp((@left), (@right))). See KUNIT_EXPECT_TRUE() 1385 * for more information. 1386 */ 1387 #define KUNIT_EXPECT_STREQ(test, left, right) \ 1388 KUNIT_BINARY_STR_EQ_ASSERTION(test, KUNIT_EXPECTATION, left, right) 1389 1390 #define KUNIT_EXPECT_STREQ_MSG(test, left, right, fmt, ...) \ 1391 KUNIT_BINARY_STR_EQ_MSG_ASSERTION(test, \ 1392 KUNIT_EXPECTATION, \ 1393 left, \ 1394 right, \ 1395 fmt, \ 1396 ##__VA_ARGS__) 1397 1398 /** 1399 * KUNIT_EXPECT_STRNEQ() - Expects that strings @left and @right are not equal. 1400 * @test: The test context object. 1401 * @left: an arbitrary expression that evaluates to a null terminated string. 1402 * @right: an arbitrary expression that evaluates to a null terminated string. 1403 * 1404 * Sets an expectation that the values that @left and @right evaluate to are 1405 * not equal. This is semantically equivalent to 1406 * KUNIT_EXPECT_TRUE(@test, strcmp((@left), (@right))). See KUNIT_EXPECT_TRUE() 1407 * for more information. 1408 */ 1409 #define KUNIT_EXPECT_STRNEQ(test, left, right) \ 1410 KUNIT_BINARY_STR_NE_ASSERTION(test, KUNIT_EXPECTATION, left, right) 1411 1412 #define KUNIT_EXPECT_STRNEQ_MSG(test, left, right, fmt, ...) \ 1413 KUNIT_BINARY_STR_NE_MSG_ASSERTION(test, \ 1414 KUNIT_EXPECTATION, \ 1415 left, \ 1416 right, \ 1417 fmt, \ 1418 ##__VA_ARGS__) 1419 1420 /** 1421 * KUNIT_EXPECT_NOT_ERR_OR_NULL() - Expects that @ptr is not null and not err. 1422 * @test: The test context object. 1423 * @ptr: an arbitrary pointer. 1424 * 1425 * Sets an expectation that the value that @ptr evaluates to is not null and not 1426 * an errno stored in a pointer. This is semantically equivalent to 1427 * KUNIT_EXPECT_TRUE(@test, !IS_ERR_OR_NULL(@ptr)). See KUNIT_EXPECT_TRUE() for 1428 * more information. 1429 */ 1430 #define KUNIT_EXPECT_NOT_ERR_OR_NULL(test, ptr) \ 1431 KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION(test, KUNIT_EXPECTATION, ptr) 1432 1433 #define KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(test, ptr, fmt, ...) \ 1434 KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test, \ 1435 KUNIT_EXPECTATION, \ 1436 ptr, \ 1437 fmt, \ 1438 ##__VA_ARGS__) 1439 1440 #define KUNIT_ASSERT_FAILURE(test, fmt, ...) \ 1441 KUNIT_FAIL_ASSERTION(test, KUNIT_ASSERTION, fmt, ##__VA_ARGS__) 1442 1443 /** 1444 * KUNIT_ASSERT_TRUE() - Sets an assertion that @condition is true. 1445 * @test: The test context object. 1446 * @condition: an arbitrary boolean expression. The test fails and aborts when 1447 * this does not evaluate to true. 1448 * 1449 * This and assertions of the form `KUNIT_ASSERT_*` will cause the test case to 1450 * fail *and immediately abort* when the specified condition is not met. Unlike 1451 * an expectation failure, it will prevent the test case from continuing to run; 1452 * this is otherwise known as an *assertion failure*. 1453 */ 1454 #define KUNIT_ASSERT_TRUE(test, condition) \ 1455 KUNIT_TRUE_ASSERTION(test, KUNIT_ASSERTION, condition) 1456 1457 #define KUNIT_ASSERT_TRUE_MSG(test, condition, fmt, ...) \ 1458 KUNIT_TRUE_MSG_ASSERTION(test, \ 1459 KUNIT_ASSERTION, \ 1460 condition, \ 1461 fmt, \ 1462 ##__VA_ARGS__) 1463 1464 /** 1465 * KUNIT_ASSERT_FALSE() - Sets an assertion that @condition is false. 1466 * @test: The test context object. 1467 * @condition: an arbitrary boolean expression. 1468 * 1469 * Sets an assertion that the value that @condition evaluates to is false. This 1470 * is the same as KUNIT_EXPECT_FALSE(), except it causes an assertion failure 1471 * (see KUNIT_ASSERT_TRUE()) when the assertion is not met. 1472 */ 1473 #define KUNIT_ASSERT_FALSE(test, condition) \ 1474 KUNIT_FALSE_ASSERTION(test, KUNIT_ASSERTION, condition) 1475 1476 #define KUNIT_ASSERT_FALSE_MSG(test, condition, fmt, ...) \ 1477 KUNIT_FALSE_MSG_ASSERTION(test, \ 1478 KUNIT_ASSERTION, \ 1479 condition, \ 1480 fmt, \ 1481 ##__VA_ARGS__) 1482 1483 /** 1484 * KUNIT_ASSERT_EQ() - Sets an assertion that @left and @right are equal. 1485 * @test: The test context object. 1486 * @left: an arbitrary expression that evaluates to a primitive C type. 1487 * @right: an arbitrary expression that evaluates to a primitive C type. 1488 * 1489 * Sets an assertion that the values that @left and @right evaluate to are 1490 * equal. This is the same as KUNIT_EXPECT_EQ(), except it causes an assertion 1491 * failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met. 1492 */ 1493 #define KUNIT_ASSERT_EQ(test, left, right) \ 1494 KUNIT_BINARY_EQ_ASSERTION(test, KUNIT_ASSERTION, left, right) 1495 1496 #define KUNIT_ASSERT_EQ_MSG(test, left, right, fmt, ...) \ 1497 KUNIT_BINARY_EQ_MSG_ASSERTION(test, \ 1498 KUNIT_ASSERTION, \ 1499 left, \ 1500 right, \ 1501 fmt, \ 1502 ##__VA_ARGS__) 1503 1504 /** 1505 * KUNIT_ASSERT_PTR_EQ() - Asserts that pointers @left and @right are equal. 1506 * @test: The test context object. 1507 * @left: an arbitrary expression that evaluates to a pointer. 1508 * @right: an arbitrary expression that evaluates to a pointer. 1509 * 1510 * Sets an assertion that the values that @left and @right evaluate to are 1511 * equal. This is the same as KUNIT_EXPECT_EQ(), except it causes an assertion 1512 * failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met. 1513 */ 1514 #define KUNIT_ASSERT_PTR_EQ(test, left, right) \ 1515 KUNIT_BINARY_PTR_EQ_ASSERTION(test, KUNIT_ASSERTION, left, right) 1516 1517 #define KUNIT_ASSERT_PTR_EQ_MSG(test, left, right, fmt, ...) \ 1518 KUNIT_BINARY_PTR_EQ_MSG_ASSERTION(test, \ 1519 KUNIT_ASSERTION, \ 1520 left, \ 1521 right, \ 1522 fmt, \ 1523 ##__VA_ARGS__) 1524 1525 /** 1526 * KUNIT_ASSERT_NE() - An assertion that @left and @right are not equal. 1527 * @test: The test context object. 1528 * @left: an arbitrary expression that evaluates to a primitive C type. 1529 * @right: an arbitrary expression that evaluates to a primitive C type. 1530 * 1531 * Sets an assertion that the values that @left and @right evaluate to are not 1532 * equal. This is the same as KUNIT_EXPECT_NE(), except it causes an assertion 1533 * failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met. 1534 */ 1535 #define KUNIT_ASSERT_NE(test, left, right) \ 1536 KUNIT_BINARY_NE_ASSERTION(test, KUNIT_ASSERTION, left, right) 1537 1538 #define KUNIT_ASSERT_NE_MSG(test, left, right, fmt, ...) \ 1539 KUNIT_BINARY_NE_MSG_ASSERTION(test, \ 1540 KUNIT_ASSERTION, \ 1541 left, \ 1542 right, \ 1543 fmt, \ 1544 ##__VA_ARGS__) 1545 1546 /** 1547 * KUNIT_ASSERT_PTR_NE() - Asserts that pointers @left and @right are not equal. 1548 * KUNIT_ASSERT_PTR_EQ() - Asserts that pointers @left and @right are equal. 1549 * @test: The test context object. 1550 * @left: an arbitrary expression that evaluates to a pointer. 1551 * @right: an arbitrary expression that evaluates to a pointer. 1552 * 1553 * Sets an assertion that the values that @left and @right evaluate to are not 1554 * equal. This is the same as KUNIT_EXPECT_NE(), except it causes an assertion 1555 * failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met. 1556 */ 1557 #define KUNIT_ASSERT_PTR_NE(test, left, right) \ 1558 KUNIT_BINARY_PTR_NE_ASSERTION(test, KUNIT_ASSERTION, left, right) 1559 1560 #define KUNIT_ASSERT_PTR_NE_MSG(test, left, right, fmt, ...) \ 1561 KUNIT_BINARY_PTR_NE_MSG_ASSERTION(test, \ 1562 KUNIT_ASSERTION, \ 1563 left, \ 1564 right, \ 1565 fmt, \ 1566 ##__VA_ARGS__) 1567 /** 1568 * KUNIT_ASSERT_LT() - An assertion that @left is less than @right. 1569 * @test: The test context object. 1570 * @left: an arbitrary expression that evaluates to a primitive C type. 1571 * @right: an arbitrary expression that evaluates to a primitive C type. 1572 * 1573 * Sets an assertion that the value that @left evaluates to is less than the 1574 * value that @right evaluates to. This is the same as KUNIT_EXPECT_LT(), except 1575 * it causes an assertion failure (see KUNIT_ASSERT_TRUE()) when the assertion 1576 * is not met. 1577 */ 1578 #define KUNIT_ASSERT_LT(test, left, right) \ 1579 KUNIT_BINARY_LT_ASSERTION(test, KUNIT_ASSERTION, left, right) 1580 1581 #define KUNIT_ASSERT_LT_MSG(test, left, right, fmt, ...) \ 1582 KUNIT_BINARY_LT_MSG_ASSERTION(test, \ 1583 KUNIT_ASSERTION, \ 1584 left, \ 1585 right, \ 1586 fmt, \ 1587 ##__VA_ARGS__) 1588 /** 1589 * KUNIT_ASSERT_LE() - An assertion that @left is less than or equal to @right. 1590 * @test: The test context object. 1591 * @left: an arbitrary expression that evaluates to a primitive C type. 1592 * @right: an arbitrary expression that evaluates to a primitive C type. 1593 * 1594 * Sets an assertion that the value that @left evaluates to is less than or 1595 * equal to the value that @right evaluates to. This is the same as 1596 * KUNIT_EXPECT_LE(), except it causes an assertion failure (see 1597 * KUNIT_ASSERT_TRUE()) when the assertion is not met. 1598 */ 1599 #define KUNIT_ASSERT_LE(test, left, right) \ 1600 KUNIT_BINARY_LE_ASSERTION(test, KUNIT_ASSERTION, left, right) 1601 1602 #define KUNIT_ASSERT_LE_MSG(test, left, right, fmt, ...) \ 1603 KUNIT_BINARY_LE_MSG_ASSERTION(test, \ 1604 KUNIT_ASSERTION, \ 1605 left, \ 1606 right, \ 1607 fmt, \ 1608 ##__VA_ARGS__) 1609 1610 /** 1611 * KUNIT_ASSERT_GT() - An assertion that @left is greater than @right. 1612 * @test: The test context object. 1613 * @left: an arbitrary expression that evaluates to a primitive C type. 1614 * @right: an arbitrary expression that evaluates to a primitive C type. 1615 * 1616 * Sets an assertion that the value that @left evaluates to is greater than the 1617 * value that @right evaluates to. This is the same as KUNIT_EXPECT_GT(), except 1618 * it causes an assertion failure (see KUNIT_ASSERT_TRUE()) when the assertion 1619 * is not met. 1620 */ 1621 #define KUNIT_ASSERT_GT(test, left, right) \ 1622 KUNIT_BINARY_GT_ASSERTION(test, KUNIT_ASSERTION, left, right) 1623 1624 #define KUNIT_ASSERT_GT_MSG(test, left, right, fmt, ...) \ 1625 KUNIT_BINARY_GT_MSG_ASSERTION(test, \ 1626 KUNIT_ASSERTION, \ 1627 left, \ 1628 right, \ 1629 fmt, \ 1630 ##__VA_ARGS__) 1631 1632 /** 1633 * KUNIT_ASSERT_GE() - Assertion that @left is greater than or equal to @right. 1634 * @test: The test context object. 1635 * @left: an arbitrary expression that evaluates to a primitive C type. 1636 * @right: an arbitrary expression that evaluates to a primitive C type. 1637 * 1638 * Sets an assertion that the value that @left evaluates to is greater than the 1639 * value that @right evaluates to. This is the same as KUNIT_EXPECT_GE(), except 1640 * it causes an assertion failure (see KUNIT_ASSERT_TRUE()) when the assertion 1641 * is not met. 1642 */ 1643 #define KUNIT_ASSERT_GE(test, left, right) \ 1644 KUNIT_BINARY_GE_ASSERTION(test, KUNIT_ASSERTION, left, right) 1645 1646 #define KUNIT_ASSERT_GE_MSG(test, left, right, fmt, ...) \ 1647 KUNIT_BINARY_GE_MSG_ASSERTION(test, \ 1648 KUNIT_ASSERTION, \ 1649 left, \ 1650 right, \ 1651 fmt, \ 1652 ##__VA_ARGS__) 1653 1654 /** 1655 * KUNIT_ASSERT_STREQ() - An assertion that strings @left and @right are equal. 1656 * @test: The test context object. 1657 * @left: an arbitrary expression that evaluates to a null terminated string. 1658 * @right: an arbitrary expression that evaluates to a null terminated string. 1659 * 1660 * Sets an assertion that the values that @left and @right evaluate to are 1661 * equal. This is the same as KUNIT_EXPECT_STREQ(), except it causes an 1662 * assertion failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met. 1663 */ 1664 #define KUNIT_ASSERT_STREQ(test, left, right) \ 1665 KUNIT_BINARY_STR_EQ_ASSERTION(test, KUNIT_ASSERTION, left, right) 1666 1667 #define KUNIT_ASSERT_STREQ_MSG(test, left, right, fmt, ...) \ 1668 KUNIT_BINARY_STR_EQ_MSG_ASSERTION(test, \ 1669 KUNIT_ASSERTION, \ 1670 left, \ 1671 right, \ 1672 fmt, \ 1673 ##__VA_ARGS__) 1674 1675 /** 1676 * KUNIT_ASSERT_STRNEQ() - Expects that strings @left and @right are not equal. 1677 * @test: The test context object. 1678 * @left: an arbitrary expression that evaluates to a null terminated string. 1679 * @right: an arbitrary expression that evaluates to a null terminated string. 1680 * 1681 * Sets an expectation that the values that @left and @right evaluate to are 1682 * not equal. This is semantically equivalent to 1683 * KUNIT_ASSERT_TRUE(@test, strcmp((@left), (@right))). See KUNIT_ASSERT_TRUE() 1684 * for more information. 1685 */ 1686 #define KUNIT_ASSERT_STRNEQ(test, left, right) \ 1687 KUNIT_BINARY_STR_NE_ASSERTION(test, KUNIT_ASSERTION, left, right) 1688 1689 #define KUNIT_ASSERT_STRNEQ_MSG(test, left, right, fmt, ...) \ 1690 KUNIT_BINARY_STR_NE_MSG_ASSERTION(test, \ 1691 KUNIT_ASSERTION, \ 1692 left, \ 1693 right, \ 1694 fmt, \ 1695 ##__VA_ARGS__) 1696 1697 /** 1698 * KUNIT_ASSERT_NOT_ERR_OR_NULL() - Assertion that @ptr is not null and not err. 1699 * @test: The test context object. 1700 * @ptr: an arbitrary pointer. 1701 * 1702 * Sets an assertion that the value that @ptr evaluates to is not null and not 1703 * an errno stored in a pointer. This is the same as 1704 * KUNIT_EXPECT_NOT_ERR_OR_NULL(), except it causes an assertion failure (see 1705 * KUNIT_ASSERT_TRUE()) when the assertion is not met. 1706 */ 1707 #define KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr) \ 1708 KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION(test, KUNIT_ASSERTION, ptr) 1709 1710 #define KUNIT_ASSERT_NOT_ERR_OR_NULL_MSG(test, ptr, fmt, ...) \ 1711 KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test, \ 1712 KUNIT_ASSERTION, \ 1713 ptr, \ 1714 fmt, \ 1715 ##__VA_ARGS__) 1716 1717 /** 1718 * kunit_param_generator_helper() - Helper method for test parameter generators 1719 * required in parameterized tests. 1720 * @test: The test context object. 1721 * @prev_param: a pointer to the previous test parameter, NULL for first parameter. 1722 * @param_array: a user-supplied pointer to an array of test parameters. 1723 * @array_size: number of test parameters in the array. 1724 * @type_size: size of one test parameter. 1725 */ 1726 static inline void *kunit_param_generator_helper(struct kunit *test, 1727 void *prev_param, 1728 void *param_array, 1729 size_t array_size, 1730 size_t type_size) 1731 { > 1732 KUNIT_ASSERT_EQ(test, (prev_param - param_array) % type_size, 0); 1733 1734 if (!prev_param) 1735 return param_array; 1736 > 1737 KUNIT_ASSERT_GE(test, prev_param, param_array); 1738 1739 if (prev_param + type_size < param_array + (array_size * type_size)) 1740 return prev_param + type_size; 1741 else 1742 return NULL; 1743 } 1744 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip