mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Subject: [PATCH 1/3] tftp: remove selftest
Date: Fri, 16 Sep 2022 14:52:30 +0200	[thread overview]
Message-ID: <20220916125232.3775559-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20220916125232.3775559-1-s.hauer@pengutronix.de>

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@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




  reply	other threads:[~2022-09-16 12:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-16 12:52 [PATCH 0/3] tftp updates Sascha Hauer
2022-09-16 12:52 ` Sascha Hauer [this message]
2022-09-16 12:52 ` [PATCH 2/3] tftp: implement UDP reorder cache using lists Sascha Hauer
2022-09-16 14:12   ` Enrico Scholz
2022-09-19  7:33     ` Sascha Hauer
2022-09-16 12:52 ` [PATCH 3/3] net: designware_eqos: Allocate more receive buffers Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220916125232.3775559-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=enrico.scholz@sigma-chemnitz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox