kunit: fat: test cluster and directory i_pos layout helpers
Subsystems (2)
PATCH 1/1 kunit: fat: test cluster and directory i_pos layout helpers
Add KUnit coverage for fat_clus_to_blknr() and fat_get_blknr_offset() using stub msdos_sb_info values so cluster-to-sector and i_pos split math stays correct.
--- fs/fat/fat_test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
fs/fat/fat_test.c +33 -0
@@ -20,6 +20,37 @@ static void fat_checksum_test(struct kunit *test)KUNIT_EXPECT_EQ (test,fat_checksum ("ABCDEFGHA " ), (u8 )98 ); } +static void fat_clus_to_blknr_test (struct kunit *test) +{ +struct msdos_sb_info sbi = { + .sec_per_clus =4 , + .data_start =100 , + }; + +KUNIT_EXPECT_EQ (test, (sector_t )100 , +fat_clus_to_blknr (&sbi,FAT_START_ENT )); +KUNIT_EXPECT_EQ (test, (sector_t )112 ,fat_clus_to_blknr (&sbi,5 )); +} + +static void fat_get_blknr_offset_test (struct kunit *test) +{ +struct msdos_sb_info sbi = { + .dir_per_block =16 , + .dir_per_block_bits =4 , + }; + +sector_t blknr; +int offset; + +fat_get_blknr_offset (&sbi,0 , &blknr, &offset); +KUNIT_EXPECT_EQ (test, (sector_t )0 , blknr); +KUNIT_EXPECT_EQ (test,0 , offset); + +fat_get_blknr_offset (&sbi, (10 <<4 ) |7 , &blknr, &offset); +KUNIT_EXPECT_EQ (test, (sector_t )10 , blknr); +KUNIT_EXPECT_EQ (test,7 , offset); +} +struct fat_timestamp_testcase {const char *name;struct timespec64 ts;
@@ -181,6 +212,8 @@ static void fat_time_unix2fat_test(struct kunit *test)static struct kunit_case fat_test_cases[] = {KUNIT_CASE (fat_checksum_test), +KUNIT_CASE (fat_clus_to_blknr_test), +KUNIT_CASE (fat_get_blknr_offset_test),KUNIT_CASE_PARAM (fat_time_fat2unix_test, fat_time_gen_params),KUNIT_CASE_PARAM (fat_time_unix2fat_test, fat_time_gen_params), {},
Signature · 1 line
2.47.3
Quoted 5 lines · Adi Nata
Add KUnit coverage for
fat_clus_to_blknr()andfat_get_blknr_offset()using stubmsdos_sb_infovalues so cluster-to-sector andi_possplit math stays correct.Signed-off-by Adi Nata <[email protected]>
Looks good.
Thanks.
Quoted 55 lines
--- fs/fat/fat_test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)fs/fat/fat_test.c +33
-0@@ -20,6 +20,37 @@ static void fat_checksum_test(struct kunit *test)KUNIT_EXPECT_EQ (test,fat_checksum ("ABCDEFGHA " ), (u8 )98 ); } +static void fat_clus_to_blknr_test (struct kunit *test) +{ +struct msdos_sb_info sbi = { + .sec_per_clus =4 , + .data_start =100 , + }; + +KUNIT_EXPECT_EQ (test, (sector_t )100 , +fat_clus_to_blknr (&sbi,FAT_START_ENT )); +KUNIT_EXPECT_EQ (test, (sector_t )112 ,fat_clus_to_blknr (&sbi,5 )); +} + +static void fat_get_blknr_offset_test (struct kunit *test) +{ +struct msdos_sb_info sbi = { + .dir_per_block =16 , + .dir_per_block_bits =4 , + }; + +sector_t blknr; +int offset; + +fat_get_blknr_offset (&sbi,0 , &blknr, &offset); +KUNIT_EXPECT_EQ (test, (sector_t )0 , blknr); +KUNIT_EXPECT_EQ (test,0 , offset); + +fat_get_blknr_offset (&sbi, (10 <<4 ) |7 , &blknr, &offset); +KUNIT_EXPECT_EQ (test, (sector_t )10 , blknr); +KUNIT_EXPECT_EQ (test,7 , offset); +} +struct fat_timestamp_testcase {const char *name;struct timespec64 ts;@@ -181,6 +212,8 @@ static void fat_time_unix2fat_test(struct kunit *test)static struct kunit_case fat_test_cases[] = {KUNIT_CASE (fat_checksum_test), +KUNIT_CASE (fat_clus_to_blknr_test), +KUNIT_CASE (fat_get_blknr_offset_test),KUNIT_CASE_PARAM (fat_time_fat2unix_test, fat_time_gen_params),KUNIT_CASE_PARAM (fat_time_unix2fat_test, fat_time_gen_params), {},
Signature · 1 line
OGAWA Hirofumi <[email protected]>
OGAWA Hirofumi
maintainerOGAWA Hirofumi <[email protected]> writes:
Hi, Christian. ping?
Quoted 69 lines
Quoted 5 lines · Adi Nata
Add KUnit coverage for
fat_clus_to_blknr()andfat_get_blknr_offset()using stubmsdos_sb_infovalues so cluster-to-sector andi_possplit math stays correct.Signed-off-by Adi Nata <[email protected]>Looks good.
Acked-by OGAWA Hirofumi <[email protected]>Thanks.
Quoted 55 lines
--- fs/fat/fat_test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)fs/fat/fat_test.c +33
-0@@ -20,6 +20,37 @@ static void fat_checksum_test(struct kunit *test)KUNIT_EXPECT_EQ (test,fat_checksum ("ABCDEFGHA " ), (u8 )98 ); } +static void fat_clus_to_blknr_test (struct kunit *test) +{ +struct msdos_sb_info sbi = { + .sec_per_clus =4 , + .data_start =100 , + }; + +KUNIT_EXPECT_EQ (test, (sector_t )100 , +fat_clus_to_blknr (&sbi,FAT_START_ENT )); +KUNIT_EXPECT_EQ (test, (sector_t )112 ,fat_clus_to_blknr (&sbi,5 )); +} + +static void fat_get_blknr_offset_test (struct kunit *test) +{ +struct msdos_sb_info sbi = { + .dir_per_block =16 , + .dir_per_block_bits =4 , + }; + +sector_t blknr; +int offset; + +fat_get_blknr_offset (&sbi,0 , &blknr, &offset); +KUNIT_EXPECT_EQ (test, (sector_t )0 , blknr); +KUNIT_EXPECT_EQ (test,0 , offset); + +fat_get_blknr_offset (&sbi, (10 <<4 ) |7 , &blknr, &offset); +KUNIT_EXPECT_EQ (test, (sector_t )10 , blknr); +KUNIT_EXPECT_EQ (test,7 , offset); +} +struct fat_timestamp_testcase {const char *name;struct timespec64 ts;@@ -181,6 +212,8 @@ static void fat_time_unix2fat_test(struct kunit *test)static struct kunit_case fat_test_cases[] = {KUNIT_CASE (fat_checksum_test), +KUNIT_CASE (fat_clus_to_blknr_test), +KUNIT_CASE (fat_get_blknr_offset_test),KUNIT_CASE_PARAM (fat_time_fat2unix_test, fat_time_gen_params),KUNIT_CASE_PARAM (fat_time_unix2fat_test, fat_time_gen_params), {},
Signature · 1 line
OGAWA Hirofumi <[email protected]>
OGAWA Hirofumi
maintainerOGAWA Hirofumi <[email protected]> writes:
ping?
Quoted 73 lines
OGAWA Hirofumi <[email protected]> writes:
Hi, Christian. ping?
Quoted 69 lines
Quoted 5 lines · Adi Nata
Add KUnit coverage for
fat_clus_to_blknr()andfat_get_blknr_offset()using stubmsdos_sb_infovalues so cluster-to-sector andi_possplit math stays correct.Signed-off-by Adi Nata <[email protected]>Looks good.
Acked-by OGAWA Hirofumi <[email protected]>Thanks.
Quoted 55 lines
--- fs/fat/fat_test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)fs/fat/fat_test.c +33
-0@@ -20,6 +20,37 @@ static void fat_checksum_test(struct kunit *test)KUNIT_EXPECT_EQ (test,fat_checksum ("ABCDEFGHA " ), (u8 )98 ); } +static void fat_clus_to_blknr_test (struct kunit *test) +{ +struct msdos_sb_info sbi = { + .sec_per_clus =4 , + .data_start =100 , + }; + +KUNIT_EXPECT_EQ (test, (sector_t )100 , +fat_clus_to_blknr (&sbi,FAT_START_ENT )); +KUNIT_EXPECT_EQ (test, (sector_t )112 ,fat_clus_to_blknr (&sbi,5 )); +} + +static void fat_get_blknr_offset_test (struct kunit *test) +{ +struct msdos_sb_info sbi = { + .dir_per_block =16 , + .dir_per_block_bits =4 , + }; + +sector_t blknr; +int offset; + +fat_get_blknr_offset (&sbi,0 , &blknr, &offset); +KUNIT_EXPECT_EQ (test, (sector_t )0 , blknr); +KUNIT_EXPECT_EQ (test,0 , offset); + +fat_get_blknr_offset (&sbi, (10 <<4 ) |7 , &blknr, &offset); +KUNIT_EXPECT_EQ (test, (sector_t )10 , blknr); +KUNIT_EXPECT_EQ (test,7 , offset); +} +struct fat_timestamp_testcase {const char *name;struct timespec64 ts;@@ -181,6 +212,8 @@ static void fat_time_unix2fat_test(struct kunit *test)static struct kunit_case fat_test_cases[] = {KUNIT_CASE (fat_checksum_test), +KUNIT_CASE (fat_clus_to_blknr_test), +KUNIT_CASE (fat_get_blknr_offset_test),KUNIT_CASE_PARAM (fat_time_fat2unix_test, fat_time_gen_params),KUNIT_CASE_PARAM (fat_time_unix2fat_test, fat_time_gen_params), {},
Signature · 1 line
OGAWA Hirofumi <[email protected]>
OGAWA Hirofumi
maintainerOGAWA Hirofumi <[email protected]> writes:
Hi, Andrew
Could you pick fat patches again? Christian's path didn't work for fat (no response for 10 days).
Thanks.
Quoted 77 lines
OGAWA Hirofumi <[email protected]> writes:
ping?
Quoted 73 lines
OGAWA Hirofumi <[email protected]> writes:
Hi, Christian. ping?
Quoted 69 lines
Quoted 5 lines · Adi Nata
Add KUnit coverage for
fat_clus_to_blknr()andfat_get_blknr_offset()using stubmsdos_sb_infovalues so cluster-to-sector andi_possplit math stays correct.Signed-off-by Adi Nata <[email protected]>Looks good.
Acked-by OGAWA Hirofumi <[email protected]>Thanks.
Quoted 55 lines
--- fs/fat/fat_test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)fs/fat/fat_test.c +33
-0@@ -20,6 +20,37 @@ static void fat_checksum_test(struct kunit *test)KUNIT_EXPECT_EQ (test,fat_checksum ("ABCDEFGHA " ), (u8 )98 ); } +static void fat_clus_to_blknr_test (struct kunit *test) +{ +struct msdos_sb_info sbi = { + .sec_per_clus =4 , + .data_start =100 , + }; + +KUNIT_EXPECT_EQ (test, (sector_t )100 , +fat_clus_to_blknr (&sbi,FAT_START_ENT )); +KUNIT_EXPECT_EQ (test, (sector_t )112 ,fat_clus_to_blknr (&sbi,5 )); +} + +static void fat_get_blknr_offset_test (struct kunit *test) +{ +struct msdos_sb_info sbi = { + .dir_per_block =16 , + .dir_per_block_bits =4 , + }; + +sector_t blknr; +int offset; + +fat_get_blknr_offset (&sbi,0 , &blknr, &offset); +KUNIT_EXPECT_EQ (test, (sector_t )0 , blknr); +KUNIT_EXPECT_EQ (test,0 , offset); + +fat_get_blknr_offset (&sbi, (10 <<4 ) |7 , &blknr, &offset); +KUNIT_EXPECT_EQ (test, (sector_t )10 , blknr); +KUNIT_EXPECT_EQ (test,7 , offset); +} +struct fat_timestamp_testcase {const char *name;struct timespec64 ts;@@ -181,6 +212,8 @@ static void fat_time_unix2fat_test(struct kunit *test)static struct kunit_case fat_test_cases[] = {KUNIT_CASE (fat_checksum_test), +KUNIT_CASE (fat_clus_to_blknr_test), +KUNIT_CASE (fat_get_blknr_offset_test),KUNIT_CASE_PARAM (fat_time_fat2unix_test, fat_time_gen_params),KUNIT_CASE_PARAM (fat_time_unix2fat_test, fat_time_gen_params), {},
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 8 lines
OGAWA Hirofumi <[email protected]> writes:
Hi, Andrew
Could you pick fat patches again? Christian's path didn't work for fat (no response for 10 days).
Thanks.
Hi Hirofumi,
Thank you for confirming the commit and chasing for the merge. I will loop in the linux kernel mentees mailbox for the Mentorship programme requirement. I hope this can help with merging fat code updates too.
Regards,
Adi Nata