Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kunit: split resource API from test.h into new resource.h

Background:
Currently, a reader looking at kunit/test.h will find the file is quite
long, and the first meaty comment is a doc comment about struct
kunit_resource.

Most users will not ever use the KUnit resource API directly.
They'll use kunit_kmalloc() and friends, or decide it's simpler to do
cleanups via labels (it often can be) instead of figuring out how to use
the API.

It's also logically separate from everything else in test.h.
Removing it from the file doesn't cause any compilation errors (since
struct kunit has `struct list_head resources` to store them).

This commit:
Let's move it into a kunit/resource.h file and give it a separate page
in the docs, kunit/api/resource.rst.

We include resource.h at the bottom of test.h since
* don't want to force existing users to add a new include if they use the API
* it accesses `lock` inside `struct kunit` in a inline func
* so we can't just forward declare, and the alternatives require
uninlining the func, adding hepers to lock/unlock, or other more
invasive changes.

Now the first big comment in test.h is about kunit_case, which is a lot
more relevant to what a new user wants to know.

A side effect of this is git blame won't properly track history by
default, users need to run
$ git blame -L ,1 -C17 include/kunit/resource.h

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Daniel Latypov and committed by
Shuah Khan
61695f8c baa33315

+340 -299
+5
Documentation/dev-tools/kunit/api/index.rst
··· 6 6 .. toctree:: 7 7 8 8 test 9 + resource 9 10 10 11 This section documents the KUnit kernel testing API. It is divided into the 11 12 following sections: ··· 14 13 Documentation/dev-tools/kunit/api/test.rst 15 14 16 15 - documents all of the standard testing API 16 + 17 + Documentation/dev-tools/kunit/api/resource.rst 18 + 19 + - documents the KUnit resource API
+13
Documentation/dev-tools/kunit/api/resource.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ============ 4 + Resource API 5 + ============ 6 + 7 + This file documents the KUnit resource API. 8 + 9 + Most users won't need to use this API directly, power users can use it to store 10 + state on a per-test basis, register custom cleanup actions, and more. 11 + 12 + .. kernel-doc:: include/kunit/resource.h 13 + :internal:
+318
include/kunit/resource.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * KUnit resource API for test managed resources (allocations, etc.). 4 + * 5 + * Copyright (C) 2022, Google LLC. 6 + * Author: Daniel Latypov <dlatypov@google.com> 7 + */ 8 + 9 + #ifndef _KUNIT_RESOURCE_H 10 + #define _KUNIT_RESOURCE_H 11 + 12 + #include <kunit/test.h> 13 + 14 + #include <linux/kref.h> 15 + #include <linux/list.h> 16 + #include <linux/slab.h> 17 + #include <linux/spinlock.h> 18 + 19 + struct kunit_resource; 20 + 21 + typedef int (*kunit_resource_init_t)(struct kunit_resource *, void *); 22 + typedef void (*kunit_resource_free_t)(struct kunit_resource *); 23 + 24 + /** 25 + * struct kunit_resource - represents a *test managed resource* 26 + * @data: for the user to store arbitrary data. 27 + * @name: optional name 28 + * @free: a user supplied function to free the resource. Populated by 29 + * kunit_resource_alloc(). 30 + * 31 + * Represents a *test managed resource*, a resource which will automatically be 32 + * cleaned up at the end of a test case. 33 + * 34 + * Resources are reference counted so if a resource is retrieved via 35 + * kunit_alloc_and_get_resource() or kunit_find_resource(), we need 36 + * to call kunit_put_resource() to reduce the resource reference count 37 + * when finished with it. Note that kunit_alloc_resource() does not require a 38 + * kunit_resource_put() because it does not retrieve the resource itself. 39 + * 40 + * Example: 41 + * 42 + * .. code-block:: c 43 + * 44 + * struct kunit_kmalloc_params { 45 + * size_t size; 46 + * gfp_t gfp; 47 + * }; 48 + * 49 + * static int kunit_kmalloc_init(struct kunit_resource *res, void *context) 50 + * { 51 + * struct kunit_kmalloc_params *params = context; 52 + * res->data = kmalloc(params->size, params->gfp); 53 + * 54 + * if (!res->data) 55 + * return -ENOMEM; 56 + * 57 + * return 0; 58 + * } 59 + * 60 + * static void kunit_kmalloc_free(struct kunit_resource *res) 61 + * { 62 + * kfree(res->data); 63 + * } 64 + * 65 + * void *kunit_kmalloc(struct kunit *test, size_t size, gfp_t gfp) 66 + * { 67 + * struct kunit_kmalloc_params params; 68 + * 69 + * params.size = size; 70 + * params.gfp = gfp; 71 + * 72 + * return kunit_alloc_resource(test, kunit_kmalloc_init, 73 + * kunit_kmalloc_free, &params); 74 + * } 75 + * 76 + * Resources can also be named, with lookup/removal done on a name 77 + * basis also. kunit_add_named_resource(), kunit_find_named_resource() 78 + * and kunit_destroy_named_resource(). Resource names must be 79 + * unique within the test instance. 80 + */ 81 + struct kunit_resource { 82 + void *data; 83 + const char *name; 84 + kunit_resource_free_t free; 85 + 86 + /* private: internal use only. */ 87 + struct kref refcount; 88 + struct list_head node; 89 + }; 90 + 91 + /* 92 + * Like kunit_alloc_resource() below, but returns the struct kunit_resource 93 + * object that contains the allocation. This is mostly for testing purposes. 94 + */ 95 + struct kunit_resource *kunit_alloc_and_get_resource(struct kunit *test, 96 + kunit_resource_init_t init, 97 + kunit_resource_free_t free, 98 + gfp_t internal_gfp, 99 + void *context); 100 + 101 + /** 102 + * kunit_get_resource() - Hold resource for use. Should not need to be used 103 + * by most users as we automatically get resources 104 + * retrieved by kunit_find_resource*(). 105 + * @res: resource 106 + */ 107 + static inline void kunit_get_resource(struct kunit_resource *res) 108 + { 109 + kref_get(&res->refcount); 110 + } 111 + 112 + /* 113 + * Called when refcount reaches zero via kunit_put_resource(); 114 + * should not be called directly. 115 + */ 116 + static inline void kunit_release_resource(struct kref *kref) 117 + { 118 + struct kunit_resource *res = container_of(kref, struct kunit_resource, 119 + refcount); 120 + 121 + /* If free function is defined, resource was dynamically allocated. */ 122 + if (res->free) { 123 + res->free(res); 124 + kfree(res); 125 + } 126 + } 127 + 128 + /** 129 + * kunit_put_resource() - When caller is done with retrieved resource, 130 + * kunit_put_resource() should be called to drop 131 + * reference count. The resource list maintains 132 + * a reference count on resources, so if no users 133 + * are utilizing a resource and it is removed from 134 + * the resource list, it will be freed via the 135 + * associated free function (if any). Only 136 + * needs to be used if we alloc_and_get() or 137 + * find() resource. 138 + * @res: resource 139 + */ 140 + static inline void kunit_put_resource(struct kunit_resource *res) 141 + { 142 + kref_put(&res->refcount, kunit_release_resource); 143 + } 144 + 145 + /** 146 + * kunit_add_resource() - Add a *test managed resource*. 147 + * @test: The test context object. 148 + * @init: a user-supplied function to initialize the result (if needed). If 149 + * none is supplied, the resource data value is simply set to @data. 150 + * If an init function is supplied, @data is passed to it instead. 151 + * @free: a user-supplied function to free the resource (if needed). 152 + * @res: The resource. 153 + * @data: value to pass to init function or set in resource data field. 154 + */ 155 + int kunit_add_resource(struct kunit *test, 156 + kunit_resource_init_t init, 157 + kunit_resource_free_t free, 158 + struct kunit_resource *res, 159 + void *data); 160 + 161 + /** 162 + * kunit_add_named_resource() - Add a named *test managed resource*. 163 + * @test: The test context object. 164 + * @init: a user-supplied function to initialize the resource data, if needed. 165 + * @free: a user-supplied function to free the resource data, if needed. 166 + * @res: The resource. 167 + * @name: name to be set for resource. 168 + * @data: value to pass to init function or set in resource data field. 169 + */ 170 + int kunit_add_named_resource(struct kunit *test, 171 + kunit_resource_init_t init, 172 + kunit_resource_free_t free, 173 + struct kunit_resource *res, 174 + const char *name, 175 + void *data); 176 + 177 + /** 178 + * kunit_alloc_resource() - Allocates a *test managed resource*. 179 + * @test: The test context object. 180 + * @init: a user supplied function to initialize the resource. 181 + * @free: a user supplied function to free the resource. 182 + * @internal_gfp: gfp to use for internal allocations, if unsure, use GFP_KERNEL 183 + * @context: for the user to pass in arbitrary data to the init function. 184 + * 185 + * Allocates a *test managed resource*, a resource which will automatically be 186 + * cleaned up at the end of a test case. See &struct kunit_resource for an 187 + * example. 188 + * 189 + * Note: KUnit needs to allocate memory for a kunit_resource object. You must 190 + * specify an @internal_gfp that is compatible with the use context of your 191 + * resource. 192 + */ 193 + static inline void *kunit_alloc_resource(struct kunit *test, 194 + kunit_resource_init_t init, 195 + kunit_resource_free_t free, 196 + gfp_t internal_gfp, 197 + void *context) 198 + { 199 + struct kunit_resource *res; 200 + 201 + res = kzalloc(sizeof(*res), internal_gfp); 202 + if (!res) 203 + return NULL; 204 + 205 + if (!kunit_add_resource(test, init, free, res, context)) 206 + return res->data; 207 + 208 + return NULL; 209 + } 210 + 211 + typedef bool (*kunit_resource_match_t)(struct kunit *test, 212 + struct kunit_resource *res, 213 + void *match_data); 214 + 215 + /** 216 + * kunit_resource_instance_match() - Match a resource with the same instance. 217 + * @test: Test case to which the resource belongs. 218 + * @res: The resource. 219 + * @match_data: The resource pointer to match against. 220 + * 221 + * An instance of kunit_resource_match_t that matches a resource whose 222 + * allocation matches @match_data. 223 + */ 224 + static inline bool kunit_resource_instance_match(struct kunit *test, 225 + struct kunit_resource *res, 226 + void *match_data) 227 + { 228 + return res->data == match_data; 229 + } 230 + 231 + /** 232 + * kunit_resource_name_match() - Match a resource with the same name. 233 + * @test: Test case to which the resource belongs. 234 + * @res: The resource. 235 + * @match_name: The name to match against. 236 + */ 237 + static inline bool kunit_resource_name_match(struct kunit *test, 238 + struct kunit_resource *res, 239 + void *match_name) 240 + { 241 + return res->name && strcmp(res->name, match_name) == 0; 242 + } 243 + 244 + /** 245 + * kunit_find_resource() - Find a resource using match function/data. 246 + * @test: Test case to which the resource belongs. 247 + * @match: match function to be applied to resources/match data. 248 + * @match_data: data to be used in matching. 249 + */ 250 + static inline struct kunit_resource * 251 + kunit_find_resource(struct kunit *test, 252 + kunit_resource_match_t match, 253 + void *match_data) 254 + { 255 + struct kunit_resource *res, *found = NULL; 256 + unsigned long flags; 257 + 258 + spin_lock_irqsave(&test->lock, flags); 259 + 260 + list_for_each_entry_reverse(res, &test->resources, node) { 261 + if (match(test, res, (void *)match_data)) { 262 + found = res; 263 + kunit_get_resource(found); 264 + break; 265 + } 266 + } 267 + 268 + spin_unlock_irqrestore(&test->lock, flags); 269 + 270 + return found; 271 + } 272 + 273 + /** 274 + * kunit_find_named_resource() - Find a resource using match name. 275 + * @test: Test case to which the resource belongs. 276 + * @name: match name. 277 + */ 278 + static inline struct kunit_resource * 279 + kunit_find_named_resource(struct kunit *test, 280 + const char *name) 281 + { 282 + return kunit_find_resource(test, kunit_resource_name_match, 283 + (void *)name); 284 + } 285 + 286 + /** 287 + * kunit_destroy_resource() - Find a kunit_resource and destroy it. 288 + * @test: Test case to which the resource belongs. 289 + * @match: Match function. Returns whether a given resource matches @match_data. 290 + * @match_data: Data passed into @match. 291 + * 292 + * RETURNS: 293 + * 0 if kunit_resource is found and freed, -ENOENT if not found. 294 + */ 295 + int kunit_destroy_resource(struct kunit *test, 296 + kunit_resource_match_t match, 297 + void *match_data); 298 + 299 + static inline int kunit_destroy_named_resource(struct kunit *test, 300 + const char *name) 301 + { 302 + return kunit_destroy_resource(test, kunit_resource_name_match, 303 + (void *)name); 304 + } 305 + 306 + /** 307 + * kunit_remove_resource() - remove resource from resource list associated with 308 + * test. 309 + * @test: The test context object. 310 + * @res: The resource to be removed. 311 + * 312 + * Note that the resource will not be immediately freed since it is likely 313 + * the caller has a reference to it via alloc_and_get() or find(); 314 + * in this case a final call to kunit_put_resource() is required. 315 + */ 316 + void kunit_remove_resource(struct kunit *test, struct kunit_resource *res); 317 + 318 + #endif /* _KUNIT_RESOURCE_H */
+4 -299
include/kunit/test.h
··· 27 27 28 28 #include <asm/rwonce.h> 29 29 30 - struct kunit_resource; 31 - 32 - typedef int (*kunit_resource_init_t)(struct kunit_resource *, void *); 33 - typedef void (*kunit_resource_free_t)(struct kunit_resource *); 34 - 35 - /** 36 - * struct kunit_resource - represents a *test managed resource* 37 - * @data: for the user to store arbitrary data. 38 - * @name: optional name 39 - * @free: a user supplied function to free the resource. Populated by 40 - * kunit_resource_alloc(). 41 - * 42 - * Represents a *test managed resource*, a resource which will automatically be 43 - * cleaned up at the end of a test case. 44 - * 45 - * Resources are reference counted so if a resource is retrieved via 46 - * kunit_alloc_and_get_resource() or kunit_find_resource(), we need 47 - * to call kunit_put_resource() to reduce the resource reference count 48 - * when finished with it. Note that kunit_alloc_resource() does not require a 49 - * kunit_resource_put() because it does not retrieve the resource itself. 50 - * 51 - * Example: 52 - * 53 - * .. code-block:: c 54 - * 55 - * struct kunit_kmalloc_params { 56 - * size_t size; 57 - * gfp_t gfp; 58 - * }; 59 - * 60 - * static int kunit_kmalloc_init(struct kunit_resource *res, void *context) 61 - * { 62 - * struct kunit_kmalloc_params *params = context; 63 - * res->data = kmalloc(params->size, params->gfp); 64 - * 65 - * if (!res->data) 66 - * return -ENOMEM; 67 - * 68 - * return 0; 69 - * } 70 - * 71 - * static void kunit_kmalloc_free(struct kunit_resource *res) 72 - * { 73 - * kfree(res->data); 74 - * } 75 - * 76 - * void *kunit_kmalloc(struct kunit *test, size_t size, gfp_t gfp) 77 - * { 78 - * struct kunit_kmalloc_params params; 79 - * 80 - * params.size = size; 81 - * params.gfp = gfp; 82 - * 83 - * return kunit_alloc_resource(test, kunit_kmalloc_init, 84 - * kunit_kmalloc_free, &params); 85 - * } 86 - * 87 - * Resources can also be named, with lookup/removal done on a name 88 - * basis also. kunit_add_named_resource(), kunit_find_named_resource() 89 - * and kunit_destroy_named_resource(). Resource names must be 90 - * unique within the test instance. 91 - */ 92 - struct kunit_resource { 93 - void *data; 94 - const char *name; 95 - kunit_resource_free_t free; 96 - 97 - /* private: internal use only. */ 98 - struct kref refcount; 99 - struct list_head node; 100 - }; 101 - 102 30 struct kunit; 103 31 104 32 /* Size of log associated with test. */ ··· 312 384 for (test_case = suite->test_cases; test_case->run_case; test_case++) 313 385 314 386 enum kunit_status kunit_suite_has_succeeded(struct kunit_suite *suite); 315 - 316 - /* 317 - * Like kunit_alloc_resource() below, but returns the struct kunit_resource 318 - * object that contains the allocation. This is mostly for testing purposes. 319 - */ 320 - struct kunit_resource *kunit_alloc_and_get_resource(struct kunit *test, 321 - kunit_resource_init_t init, 322 - kunit_resource_free_t free, 323 - gfp_t internal_gfp, 324 - void *context); 325 - 326 - /** 327 - * kunit_get_resource() - Hold resource for use. Should not need to be used 328 - * by most users as we automatically get resources 329 - * retrieved by kunit_find_resource*(). 330 - * @res: resource 331 - */ 332 - static inline void kunit_get_resource(struct kunit_resource *res) 333 - { 334 - kref_get(&res->refcount); 335 - } 336 - 337 - /* 338 - * Called when refcount reaches zero via kunit_put_resources(); 339 - * should not be called directly. 340 - */ 341 - static inline void kunit_release_resource(struct kref *kref) 342 - { 343 - struct kunit_resource *res = container_of(kref, struct kunit_resource, 344 - refcount); 345 - 346 - /* If free function is defined, resource was dynamically allocated. */ 347 - if (res->free) { 348 - res->free(res); 349 - kfree(res); 350 - } 351 - } 352 - 353 - /** 354 - * kunit_put_resource() - When caller is done with retrieved resource, 355 - * kunit_put_resource() should be called to drop 356 - * reference count. The resource list maintains 357 - * a reference count on resources, so if no users 358 - * are utilizing a resource and it is removed from 359 - * the resource list, it will be freed via the 360 - * associated free function (if any). Only 361 - * needs to be used if we alloc_and_get() or 362 - * find() resource. 363 - * @res: resource 364 - */ 365 - static inline void kunit_put_resource(struct kunit_resource *res) 366 - { 367 - kref_put(&res->refcount, kunit_release_resource); 368 - } 369 - 370 - /** 371 - * kunit_add_resource() - Add a *test managed resource*. 372 - * @test: The test context object. 373 - * @init: a user-supplied function to initialize the result (if needed). If 374 - * none is supplied, the resource data value is simply set to @data. 375 - * If an init function is supplied, @data is passed to it instead. 376 - * @free: a user-supplied function to free the resource (if needed). 377 - * @res: The resource. 378 - * @data: value to pass to init function or set in resource data field. 379 - */ 380 - int kunit_add_resource(struct kunit *test, 381 - kunit_resource_init_t init, 382 - kunit_resource_free_t free, 383 - struct kunit_resource *res, 384 - void *data); 385 - 386 - /** 387 - * kunit_add_named_resource() - Add a named *test managed resource*. 388 - * @test: The test context object. 389 - * @init: a user-supplied function to initialize the resource data, if needed. 390 - * @free: a user-supplied function to free the resource data, if needed. 391 - * @res: The resource. 392 - * @name: name to be set for resource. 393 - * @data: value to pass to init function or set in resource data field. 394 - */ 395 - int kunit_add_named_resource(struct kunit *test, 396 - kunit_resource_init_t init, 397 - kunit_resource_free_t free, 398 - struct kunit_resource *res, 399 - const char *name, 400 - void *data); 401 - 402 - /** 403 - * kunit_alloc_resource() - Allocates a *test managed resource*. 404 - * @test: The test context object. 405 - * @init: a user supplied function to initialize the resource. 406 - * @free: a user supplied function to free the resource. 407 - * @internal_gfp: gfp to use for internal allocations, if unsure, use GFP_KERNEL 408 - * @context: for the user to pass in arbitrary data to the init function. 409 - * 410 - * Allocates a *test managed resource*, a resource which will automatically be 411 - * cleaned up at the end of a test case. See &struct kunit_resource for an 412 - * example. 413 - * 414 - * Note: KUnit needs to allocate memory for a kunit_resource object. You must 415 - * specify an @internal_gfp that is compatible with the use context of your 416 - * resource. 417 - */ 418 - static inline void *kunit_alloc_resource(struct kunit *test, 419 - kunit_resource_init_t init, 420 - kunit_resource_free_t free, 421 - gfp_t internal_gfp, 422 - void *context) 423 - { 424 - struct kunit_resource *res; 425 - 426 - res = kzalloc(sizeof(*res), internal_gfp); 427 - if (!res) 428 - return NULL; 429 - 430 - if (!kunit_add_resource(test, init, free, res, context)) 431 - return res->data; 432 - 433 - return NULL; 434 - } 435 - 436 - typedef bool (*kunit_resource_match_t)(struct kunit *test, 437 - struct kunit_resource *res, 438 - void *match_data); 439 - 440 - /** 441 - * kunit_resource_instance_match() - Match a resource with the same instance. 442 - * @test: Test case to which the resource belongs. 443 - * @res: The resource. 444 - * @match_data: The resource pointer to match against. 445 - * 446 - * An instance of kunit_resource_match_t that matches a resource whose 447 - * allocation matches @match_data. 448 - */ 449 - static inline bool kunit_resource_instance_match(struct kunit *test, 450 - struct kunit_resource *res, 451 - void *match_data) 452 - { 453 - return res->data == match_data; 454 - } 455 - 456 - /** 457 - * kunit_resource_name_match() - Match a resource with the same name. 458 - * @test: Test case to which the resource belongs. 459 - * @res: The resource. 460 - * @match_name: The name to match against. 461 - */ 462 - static inline bool kunit_resource_name_match(struct kunit *test, 463 - struct kunit_resource *res, 464 - void *match_name) 465 - { 466 - return res->name && strcmp(res->name, match_name) == 0; 467 - } 468 - 469 - /** 470 - * kunit_find_resource() - Find a resource using match function/data. 471 - * @test: Test case to which the resource belongs. 472 - * @match: match function to be applied to resources/match data. 473 - * @match_data: data to be used in matching. 474 - */ 475 - static inline struct kunit_resource * 476 - kunit_find_resource(struct kunit *test, 477 - kunit_resource_match_t match, 478 - void *match_data) 479 - { 480 - struct kunit_resource *res, *found = NULL; 481 - unsigned long flags; 482 - 483 - spin_lock_irqsave(&test->lock, flags); 484 - 485 - list_for_each_entry_reverse(res, &test->resources, node) { 486 - if (match(test, res, (void *)match_data)) { 487 - found = res; 488 - kunit_get_resource(found); 489 - break; 490 - } 491 - } 492 - 493 - spin_unlock_irqrestore(&test->lock, flags); 494 - 495 - return found; 496 - } 497 - 498 - /** 499 - * kunit_find_named_resource() - Find a resource using match name. 500 - * @test: Test case to which the resource belongs. 501 - * @name: match name. 502 - */ 503 - static inline struct kunit_resource * 504 - kunit_find_named_resource(struct kunit *test, 505 - const char *name) 506 - { 507 - return kunit_find_resource(test, kunit_resource_name_match, 508 - (void *)name); 509 - } 510 - 511 - /** 512 - * kunit_destroy_resource() - Find a kunit_resource and destroy it. 513 - * @test: Test case to which the resource belongs. 514 - * @match: Match function. Returns whether a given resource matches @match_data. 515 - * @match_data: Data passed into @match. 516 - * 517 - * RETURNS: 518 - * 0 if kunit_resource is found and freed, -ENOENT if not found. 519 - */ 520 - int kunit_destroy_resource(struct kunit *test, 521 - kunit_resource_match_t match, 522 - void *match_data); 523 - 524 - static inline int kunit_destroy_named_resource(struct kunit *test, 525 - const char *name) 526 - { 527 - return kunit_destroy_resource(test, kunit_resource_name_match, 528 - (void *)name); 529 - } 530 - 531 - /** 532 - * kunit_remove_resource() - remove resource from resource list associated with 533 - * test. 534 - * @test: The test context object. 535 - * @res: The resource to be removed. 536 - * 537 - * Note that the resource will not be immediately freed since it is likely 538 - * the caller has a reference to it via alloc_and_get() or find(); 539 - * in this case a final call to kunit_put_resource() is required. 540 - */ 541 - void kunit_remove_resource(struct kunit *test, struct kunit_resource *res); 542 387 543 388 /** 544 389 * kunit_kmalloc_array() - Like kmalloc_array() except the allocation is *test managed*. ··· 1310 1609 } \ 1311 1610 return NULL; \ 1312 1611 } 1612 + 1613 + // TODO(dlatypov@google.com): consider eventually migrating users to explicitly 1614 + // include resource.h themselves if they need it. 1615 + #include <kunit/resource.h> 1313 1616 1314 1617 #endif /* _KUNIT_TEST_H */