[PATCH 1/3] tftp: remove selftest
Sascha Hauer
s.hauer at pengutronix.de
Fri Sep 16 05:52:30 PDT 2022
The out-of-order packet caching will be reworked in the next commit and
most of the functions the self test tests will vanish, so nothing to
test anymore.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
fs/tftp.c | 102 ----------------------------------------------
test/self/Kconfig | 7 ----
2 files changed, 109 deletions(-)
diff --git a/fs/tftp.c b/fs/tftp.c
index e0886c49d2..f089e2f693 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -1237,105 +1237,3 @@ static int tftp_init(void)
return register_fs_driver(&tftp_driver);
}
coredevice_initcall(tftp_init);
-
-
-BSELFTEST_GLOBALS();
-
-static int __maybe_unused tftp_window_cache_selftest(void)
-{
- struct tftp_cache *cache = malloc(sizeof *cache);
-
- if (!cache)
- return -ENOMEM;
-
- (void)skipped_tests;
-
- expect_it( is_block_before(0, 1));
- expect_it(!is_block_before(1, 0));
- expect_it( is_block_before(65535, 0));
- expect_it(!is_block_before(0, 65535));
-
- expect_eq(get_block_delta(0, 1), 1);
- expect_eq(get_block_delta(65535, 0), 1);
- expect_eq(get_block_delta(65535, 1), 2);
-
- expect_it(!in_window(0, 1, 3));
- expect_it( in_window(1, 1, 3));
- expect_it( in_window(2, 1, 3));
- expect_it( in_window(3, 1, 3));
- expect_it(!in_window(4, 1, 3));
-
- expect_it(!in_window(65534, 65535, 1));
- expect_it( in_window(65535, 65535, 1));
- expect_it( in_window( 0, 65535, 1));
- expect_it( in_window( 1, 65535, 1));
- expect_it(!in_window( 2, 65535, 1));
-
-
- tftp_window_cache_init(cache, 512, 5);
-
- if (tftp_window_cache_size(cache) < 4)
- goto out;
-
- expect_eq(tftp_window_cache_size(cache), 4);
-
- /* sequence 1 */
- expect_ok (tftp_window_cache_insert(cache, 20, "20", 2));
- expect_ok (tftp_window_cache_insert(cache, 22, "22", 2));
- expect_ok (tftp_window_cache_insert(cache, 21, "21", 2));
- expect_ok (tftp_window_cache_insert(cache, 23, "23", 2));
- expect_err(tftp_window_cache_insert(cache, 24, "24", 2));
- expect_err(tftp_window_cache_insert(cache, 19, "19", 2));
- expect_ok (tftp_window_cache_insert(cache, 22, "22", 2));
- expect_ok (tftp_window_cache_insert(cache, 20, "20", 2));
-
- expect_eq(tftp_window_cache_pop(cache)->id, 20);
- expect_eq(tftp_window_cache_pop(cache)->id, 21);
- expect_eq(tftp_window_cache_pop(cache)->id, 22);
- expect_eq(tftp_window_cache_pop(cache)->id, 23);
- expect_eq(cache->id, TFTP_CACHE_NO_ID);
-
- /* sequence 2 */
- expect_ok (tftp_window_cache_insert(cache, 30, "30", 2));
- expect_ok (tftp_window_cache_insert(cache, 32, "32", 2));
- expect_err(tftp_window_cache_insert(cache, 34, "34", 2));
-
- expect_it(tftp_window_cache_starts_with(cache, 30));
- expect_eq(tftp_window_cache_pop(cache)->id, 30);
-
- expect_ok (tftp_window_cache_insert(cache, 34, "34", 2));
- expect_err(tftp_window_cache_insert(cache, 35, "35", 2));
-
- expect_it(!tftp_window_cache_starts_with(cache, 30));
- expect_it(!tftp_window_cache_starts_with(cache, 31));
- expect_it(!tftp_window_cache_starts_with(cache, 32));
- expect_NULL(tftp_window_cache_pop(cache));
-
- expect_it(tftp_window_cache_starts_with(cache, 32));
- expect_eq(tftp_window_cache_pop(cache)->id, 32);
-
- expect_NULL(tftp_window_cache_pop(cache));
- expect_eq(tftp_window_cache_pop(cache)->id, 34);
-
- expect_eq(cache->id, TFTP_CACHE_NO_ID);
-
- /* sequence 3 */
- expect_ok(tftp_window_cache_insert(cache, 40, "40", 2));
- expect_ok(tftp_window_cache_insert(cache, 42, "42", 2));
- expect_ok(tftp_window_cache_insert(cache, 43, "43", 2));
-
- expect_it(!tftp_window_cache_remove_id(cache, 30));
- expect_it(!tftp_window_cache_remove_id(cache, 41));
- expect_it(!tftp_window_cache_remove_id(cache, 44));
-
- expect_it( tftp_window_cache_remove_id(cache, 42));
- expect_it(!tftp_window_cache_remove_id(cache, 42));
-
-out:
- tftp_window_cache_free(cache);
-
- return 0;
-}
-#ifdef CONFIG_SELFTEST_TFTP
-bselftest(core, tftp_window_cache_selftest);
-#endif
diff --git a/test/self/Kconfig b/test/self/Kconfig
index 03cfa89987..680196a4fe 100644
--- a/test/self/Kconfig
+++ b/test/self/Kconfig
@@ -32,7 +32,6 @@ config SELFTEST_ENABLE_ALL
select SELFTEST_PROGRESS_NOTIFIER
select SELFTEST_OF_MANIPULATION
select SELFTEST_ENVIRONMENT_VARIABLES if ENVIRONMENT_VARIABLES
- imply SELFTEST_TFTP
help
Selects all self-tests compatible with current configuration
@@ -58,10 +57,4 @@ config SELFTEST_PROGRESS_NOTIFIER
config SELFTEST_ENVIRONMENT_VARIABLES
bool "environment variable selftest"
-config SELFTEST_TFTP
- bool "tftp selftest"
- depends on FS_TFTP
- help
- Tests tftp functionality
-
endif
--
2.30.2
More information about the barebox
mailing list