support/testing: add mtd test
PATCH 1/4 support/testing: add mtd test
--- support/testing/tests/package/test_mtd.py | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 support/testing/tests/package/test_mtd.py
support/testing/tests/package/test_mtd.py new file +48 -0
@@ -0,0 +1,48 @@ +import os + +import infra.basetest + + +class TestMtd(infra.basetest.BRTest): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + BR2_ENABLE_LOCALE_WHITELIST="" + BR2_PACKAGE_MTD=y + # BR2_TARGET_ROOTFS_TAR is not set + BR2_TARGET_ROOTFS_CPIO=y + """ + + def test_run(self): + cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") + self.emulator.boot(arch="armv7", + kernel="builtin", + options=["-initrd", cpio_file]) + + self.emulator.login() + + mtd = "/dev/mtd0" + erasesize = 256 * 1024 + test_sectors = 4 + test_size = erasesize * test_sectors + + output, exit_code = self.emulator.run(f"mtd_debug info {mtd}") + output = [x.strip() for x in output if x.strip()] + self.assertEqual(output, [ + "mtd.type = MTD_NORFLASH", + "mtd.flags = MTD_CAP_NORFLASH", + "mtd.size = 134217728 (128M)", + "mtd.erasesize = 262144 (256K)", + "mtd.writesize = 1", + "mtd.oobsize = 0", + "regions = 0", + ]) + + # Test flashcp + self.assertRunOk(f"dd if=/dev/urandom of=random.bin bs={test_size} count=1") + self.assertRunOk(f"flashcp random.bin {mtd}") + self.assertRunOk(f"cmp -s -n {test_size} random.bin {mtd}") + + # Test flash_erase + self.assertRunOk(f"dd if=/dev/zero bs={test_size} count=1 | tr '\\000' '\\377' >nor-erase.bin") + self.assertRunOk(f"flash_erase {mtd} 0 {test_sectors}") + self.assertRunOk(f"cmp -s -n {test_size} nor-erase.bin {mtd}")
Signature · 6 lines
2.45.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/4 package/mtd: switch to https mirror
As mentioned in the last release notes, there is an https mirror[1]. Switch to this as ftp is not as widely supported anymore.
[1] https://lists.infradead.org/pipermail/linux-mtd/2023-August/100922.html
--- package/mtd/mtd.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/mtd/mtd.mk +1 -1
@@ -6,7 +6,7 @@ MTD_VERSION = 2.1.6 MTD_SOURCE = mtd-utils-$(MTD_VERSION).tar.bz2 -MTD_SITE = ftp://ftp.infradead.org/pub/mtd-utils +MTD_SITE = https://infraroot.at/pub/mtd MTD_LICENSE = GPL-2.0 MTD_LICENSE_FILES = COPYING MTD_CPE_ID_VENDOR = mtd-utils_project
Signature · 6 lines
2.45.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedRe: [Buildroot] [PATCH 2/4] package/mtd: switch to https mirror
Brandon, All,
On 2024-05-29 20:24 +0000, Brandon Maier via buildroot spake thusly:
Quoted 6 lines
As mentioned in the last release notes, there is an https mirror[1]. Switch to this as ftp is not as widely supported anymore.
[1] https://lists.infradead.org/pipermail/linux-mtd/2023-August/100922.html
Signed-off-by Brandon Maier <[email protected]>
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 24 lines
--- package/mtd/mtd.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/mtd/mtd.mk +1
-1@@ -6,7 +6,7 @@ MTD_VERSION = 2.1.6 MTD_SOURCE = mtd-utils-$(MTD_VERSION).tar.bz2 -MTD_SITE = ftp://ftp.infradead.org/pub/mtd-utils +MTD_SITE = https://infraroot.at/pub/mtd MTD_LICENSE = GPL-2.0 MTD_LICENSE_FILES = COPYING MTD_CPE_ID_VENDOR = mtd-utils_projectSignature · 6 lines
2.45.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/4] package/mtd: switch to https mirror
In reply to Brandon Maier via buildrootQuoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Brandon" == Brandon Maier via buildroot <[email protected]> writes:
As mentioned in the last release notes, there is an https mirror[1]. Switch to this as ftp is not as widely supported anymore.
[1] https://lists.infradead.org/pipermail/linux-mtd/2023-August/100922.html
Signed-off-by Brandon Maier <[email protected]>
Committed to 2024.02.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/4 package/mtd: bump to version 2.2.0
In reply to Brandon Maier via buildroothttps://lists.infradead.org/pipermail/linux-mtd/2024-March/104058.html
--- package/mtd/mtd.hash | 4 ++-- package/mtd/mtd.mk | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
package/mtd/mtd.hash +2 -2
@@ -1,4 +1,4 @@ # Locally calculated after checking pgp signature -# https://infraroot.at/pub/mtd/mtd-utils-2.1.6.tar.bz2.asc -sha256 c1d853bc4adf83bcabd2792fc95af33bdd8643c97e8f7b3f0180af36af76f0e5 mtd-utils-2.1.6.tar.bz2 +# https://infraroot.at/pub/mtd/mtd-utils-2.2.0.tar.bz2.asc +sha256 250d082f67375ca8451b5fcfc9a23a53ced3ebebd8312c288daf2507bbab1324 mtd-utils-2.2.0.tar.bz2 sha256 dcc100d4161cc0b7177545ab6e47216f84857cda3843847c792a25289852dcaa COPYING
package/mtd/mtd.mk +1 -1
@@ -4,7 +4,7 @@ # ################################################################################ -MTD_VERSION = 2.1.6 +MTD_VERSION = 2.2.0 MTD_SOURCE = mtd-utils-$(MTD_VERSION).tar.bz2 MTD_SITE = https://infraroot.at/pub/mtd MTD_LICENSE = GPL-2.0
Signature · 6 lines
2.45.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedRe: [Buildroot] [PATCH 3/4] package/mtd: bump to version 2.2.0
Brandon, all,
On 2024-05-29 20:24 +0000, Brandon Maier via buildroot spake thusly:
Quoted 3 lines
https://lists.infradead.org/pipermail/linux-mtd/2024-March/104058.html
Signed-off-by Brandon Maier <[email protected]>
Applied to next, thanks.
Regards,
Yann E. MORIN.
Quoted 36 lines
--- package/mtd/mtd.hash | 4 ++-- package/mtd/mtd.mk | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)package/mtd/mtd.hash +2
-2@@ -1,4 +1,4 @@ # Locally calculated after checking pgp signature -# https://infraroot.at/pub/mtd/mtd-utils-2.1.6.tar.bz2.asc -sha256 c1d853bc4adf83bcabd2792fc95af33bdd8643c97e8f7b3f0180af36af76f0e5 mtd-utils-2.1.6.tar.bz2 +# https://infraroot.at/pub/mtd/mtd-utils-2.2.0.tar.bz2.asc +sha256 250d082f67375ca8451b5fcfc9a23a53ced3ebebd8312c288daf2507bbab1324 mtd-utils-2.2.0.tar.bz2 sha256 dcc100d4161cc0b7177545ab6e47216f84857cda3843847c792a25289852dcaa COPYINGpackage/mtd/mtd.mk +1
-1@@ -4,7 +4,7 @@ # ################################################################################ -MTD_VERSION = 2.1.6 +MTD_VERSION = 2.2.0 MTD_SOURCE = mtd-utils-$(MTD_VERSION).tar.bz2 MTD_SITE = https://infraroot.at/pub/mtd MTD_LICENSE = GPL-2.0Signature · 6 lines
2.45.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 4/4 DEVELOPERS: add myself for package/mtd
In reply to Brandon Maier via buildroot--- DEVELOPERS | 1 + 1 file changed, 1 insertion(+)
DEVELOPERS +1 -0
@@ -544,6 +544,7 @@ F: configs/ls1046a-frwy_defconfig F: package/bats-assert/ F: package/bats-file/ F: package/bats-support/ +F: package/mtd/ F: package/python-pysensors/ F: package/qoriq-fm-ucode/ F: package/unifdef/
Signature · 6 lines
2.45.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedRe: [Buildroot] [PATCH 4/4] DEVELOPERS: add myself for package/mtd
Brandon, All,
On 2024-05-29 20:24 +0000, Brandon Maier via buildroot spake thusly:
Quoted 1 line
Signed-off-by Brandon Maier <[email protected]>
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 23 lines
--- DEVELOPERS | 1 + 1 file changed, 1 insertion(+)DEVELOPERS +1
-0@@ -544,6 +544,7 @@ F: configs/ls1046a-frwy_defconfig F: package/bats-assert/ F: package/bats-file/ F: package/bats-support/ +F: package/mtd/ F: package/python-pysensors/ F: package/qoriq-fm-ucode/ F: package/unifdef/Signature · 6 lines
2.45.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 4/4] DEVELOPERS: add myself for package/mtd
In reply to Brandon Maier via buildrootQuoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Brandon" == Brandon Maier via buildroot <[email protected]> writes:
Signed-off-by Brandon Maier <[email protected]>
Committed to 2024.02.x, thanks.
Quoted 24 lines
--- DEVELOPERS | 1 + 1 file changed, 1 insertion(+)DEVELOPERS +1
-0@@ -544,6 +544,7 @@ F: configs/ls1046a-frwy_defconfig F: package/bats-assert/ F: package/bats-file/ F: package/bats-support/ +F: package/mtd/ F: package/python-pysensors/ F: package/qoriq-fm-ucode/ F: package/unifdef/Signature · 6 lines
2.45.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedBrandon, All,
On 2024-05-29 20:24 +0000, Brandon Maier via buildroot spake thusly:
Quoted 1 line
Signed-off-by Brandon Maier <[email protected]>
I've dropped the BR2_ENABLE_LOCALE_WHITELIST seting, because it is not needed.
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 66 lines
--- support/testing/tests/package/test_mtd.py | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 support/testing/tests/package/test_mtd.pysupport/testing/tests/package/test_mtd.py new file +48
-0@@ -0,0 +1,48 @@ +import os + +import infra.basetest + + +class TestMtd(infra.basetest.BRTest): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + BR2_ENABLE_LOCALE_WHITELIST="" + BR2_PACKAGE_MTD=y + # BR2_TARGET_ROOTFS_TAR is not set + BR2_TARGET_ROOTFS_CPIO=y + """ + + def test_run(self): + cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") + self.emulator.boot(arch="armv7", + kernel="builtin", + options=["-initrd", cpio_file]) + + self.emulator.login() + + mtd = "/dev/mtd0" + erasesize = 256 * 1024 + test_sectors = 4 + test_size = erasesize * test_sectors + + output, exit_code = self.emulator.run(f"mtd_debug info {mtd}") + output = [x.strip() for x in output if x.strip()] + self.assertEqual(output, [ + "mtd.type = MTD_NORFLASH", + "mtd.flags = MTD_CAP_NORFLASH", + "mtd.size = 134217728 (128M)", + "mtd.erasesize = 262144 (256K)", + "mtd.writesize = 1", + "mtd.oobsize = 0", + "regions = 0", + ]) + + # Test flashcp + self.assertRunOk(f"dd if=/dev/urandom of=random.bin bs={test_size} count=1") + self.assertRunOk(f"flashcp random.bin {mtd}") + self.assertRunOk(f"cmp -s -n {test_size} random.bin {mtd}") + + # Test flash_erase + self.assertRunOk(f"dd if=/dev/zero bs={test_size} count=1 | tr '\\000' '\\377' >nor-erase.bin") + self.assertRunOk(f"flash_erase {mtd} 0 {test_sectors}") + self.assertRunOk(f"cmp -s -n {test_size} nor-erase.bin {mtd}")Signature · 6 lines
2.45.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Brandon" == Brandon Maier via buildroot <[email protected]> writes:
Signed-off-by Brandon Maier <[email protected]>
Committed to 2024.02.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot