mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 10:12:45 +01:00
tests/blob: add test application for blob.inc.mk
This commit is contained in:
parent
b4da3b464f
commit
3091de3a50
9
tests/blob/Makefile
Normal file
9
tests/blob/Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += fmt
|
||||
|
||||
BLOBS += blobtest.txt blob_subdir/blobtest_subdir.txt
|
||||
DIRS += blob_module
|
||||
USEMODULE += blob_module
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
2
tests/blob/blob_module/Makefile
Normal file
2
tests/blob/blob_module/Makefile
Normal file
@ -0,0 +1,2 @@
|
||||
BLOBS += blobtest.bin
|
||||
include $(RIOTBASE)/Makefile.base
|
12
tests/blob/blob_module/blob.c
Normal file
12
tests/blob/blob_module/blob.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include "fmt.h"
|
||||
|
||||
#include "blob/blobtest.bin.h"
|
||||
|
||||
void blobtest_bin_print(void)
|
||||
{
|
||||
for (size_t n = 0; n < blobtest_bin_len; n++) {
|
||||
print("0x", 2);
|
||||
print_byte_hex(blobtest_bin[n]);
|
||||
print("\n", 1);
|
||||
}
|
||||
}
|
BIN
tests/blob/blob_module/blobtest.bin
Normal file
BIN
tests/blob/blob_module/blobtest.bin
Normal file
Binary file not shown.
1
tests/blob/blob_subdir/blobtest_subdir.txt
Normal file
1
tests/blob/blob_subdir/blobtest_subdir.txt
Normal file
@ -0,0 +1 @@
|
||||
Hello blob_subdir!
|
1
tests/blob/blobtest.txt
Normal file
1
tests/blob/blobtest.txt
Normal file
@ -0,0 +1 @@
|
||||
Hello blob!
|
38
tests/blob/main.c
Normal file
38
tests/blob/main.c
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Kaspar Schleiser <kaspar@schleiser.de>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup tests
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief test application for including files as blobs
|
||||
*
|
||||
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "fmt.h"
|
||||
#include "blob/blobtest.txt.h"
|
||||
#include "blob/blob_subdir/blobtest_subdir.txt.h"
|
||||
|
||||
void blobtest_bin_print(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
print((char *)blobtest_txt, blobtest_txt_len);
|
||||
print("\n", 1);
|
||||
|
||||
print((char *)blobtest_subdir_txt, blobtest_subdir_txt_len);
|
||||
print("\n", 1);
|
||||
|
||||
blobtest_bin_print();
|
||||
|
||||
return 0;
|
||||
}
|
24
tests/blob/tests/01-run.py
Executable file
24
tests/blob/tests/01-run.py
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (C) 2019 Kaspar Schleiser <kaspar@schleiser.de>
|
||||
#
|
||||
# This file is subject to the terms and conditions of the GNU Lesser
|
||||
# General Public License v2.1. See the file LICENSE in the top level
|
||||
# directory for more details.
|
||||
|
||||
import sys
|
||||
from testrunner import run
|
||||
|
||||
|
||||
def testfunc(child):
|
||||
child.expect_exact("Hello blob!")
|
||||
child.expect_exact("Hello blob_subdir!")
|
||||
child.expect_exact("0x00")
|
||||
child.expect_exact("0x01")
|
||||
child.expect_exact("0x02")
|
||||
child.expect_exact("0x03")
|
||||
child.expect_exact("0xFF")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(run(testfunc))
|
Loading…
Reference in New Issue
Block a user