1
0
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:
Kaspar Schleiser 2019-07-19 12:34:10 +02:00
parent b4da3b464f
commit 3091de3a50
8 changed files with 87 additions and 0 deletions

9
tests/blob/Makefile Normal file
View 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

View File

@ -0,0 +1,2 @@
BLOBS += blobtest.bin
include $(RIOTBASE)/Makefile.base

View 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);
}
}

Binary file not shown.

View File

@ -0,0 +1 @@
Hello blob_subdir!

1
tests/blob/blobtest.txt Normal file
View File

@ -0,0 +1 @@
Hello blob!

38
tests/blob/main.c Normal file
View 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
View 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))