[2/2] libflash: More tests for blocklevel_smart_erase()

Submitted by Cyril Bur on April 20, 2017, 1:56 a.m.

Details

Message ID 20170420015639.4274-3-cyril.bur@au1.ibm.com
State New
Headers show

Commit Message

Cyril Bur April 20, 2017, 1:56 a.m.
Because the only thing better than x tests is x+1 tests.

Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
---
 libflash/test/test-blocklevel.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Michael Neuling April 20, 2017, 4:31 a.m.
On Thu, 2017-04-20 at 11:56 +1000, Cyril Bur wrote:
> Because the only thing better than x tests is x+1 tests.

Please write useful commit messages.

Added test for <something>

Mikey


> 
> Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
> ---
>  libflash/test/test-blocklevel.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/libflash/test/test-blocklevel.c b/libflash/test/test-blocklevel.c
> index 4dbbb091..c394c824 100644
> --- a/libflash/test/test-blocklevel.c
> +++ b/libflash/test/test-blocklevel.c
> @@ -432,5 +432,20 @@ int main(void)
>  		return 1;
>  	}
>  
> +	reset_buf(buf);
> +	/* Test 9: Erase a biger section, not aligned */

biger

> +	if (blocklevel_smart_erase(bl, 0x20, 0xa00)) {
> +		ERR("Failed to blocklevel_smart_erase(0x20, 0xa00)\n");
> +		return 1;
> +	}
> +	miss = check_buf(buf, 0x20, 0xa20);
> +	if (miss) {
> +		ERR("Buffer mismatch after blocklevel_smart_erase(0x20,
> 0xa00) at 0x%x\n",
> +				miss == -1 ? 0 : miss);
> +		dump_buf(buf, 0x1c, 0x25, miss == -1 ? 0 : miss);
> +		dump_buf(buf, 0xa1c, 0xa25, miss == -1 ? 0 : miss);
> +		return 1;
> +	}
> +
>  	return 0;
>  }

Patch hide | download patch | download mbox

diff --git a/libflash/test/test-blocklevel.c b/libflash/test/test-blocklevel.c
index 4dbbb091..c394c824 100644
--- a/libflash/test/test-blocklevel.c
+++ b/libflash/test/test-blocklevel.c
@@ -432,5 +432,20 @@  int main(void)
 		return 1;
 	}
 
+	reset_buf(buf);
+	/* Test 9: Erase a biger section, not aligned */
+	if (blocklevel_smart_erase(bl, 0x20, 0xa00)) {
+		ERR("Failed to blocklevel_smart_erase(0x20, 0xa00)\n");
+		return 1;
+	}
+	miss = check_buf(buf, 0x20, 0xa20);
+	if (miss) {
+		ERR("Buffer mismatch after blocklevel_smart_erase(0x20, 0xa00) at 0x%x\n",
+				miss == -1 ? 0 : miss);
+		dump_buf(buf, 0x1c, 0x25, miss == -1 ? 0 : miss);
+		dump_buf(buf, 0xa1c, 0xa25, miss == -1 ? 0 : miss);
+		return 1;
+	}
+
 	return 0;
 }