Skip to content

Commit

Permalink
Add tests for SRC in makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
plmorange committed Nov 1, 2024
1 parent 7f738bf commit 62ff1f9
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/build_system/src_folders/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include ../Makefile.build_system_common

# Add subfolders as modules
DIRS += module_testing
USEMODULE += my_module

# Add fmt to read blob
USEMODULE += fmt

# Add blobs

Check failure on line 10 in tests/build_system/src_folders/Makefile

View workflow job for this annotation

GitHub Actions / static-tests

trailing whitespace.
BLOBS += blob/blob_subdir/blobtest_subdir.txt

SRC += main.c
SRC += folder/a.c blob/blob_test.c folder/subfolder/b.c
# # Alternative method to add files in subfolders using wildcards
# # SRC += $(wildcard *.c blob/*.c folder/*.c folder/**/*.c)

include $(RIOTBASE)/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello blob_subdir!
17 changes: 17 additions & 0 deletions tests/build_system/src_folders/blob/blob_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (C) 2024 Orange
*
* 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.
*/

#include "fmt.h"

#include "blob/blob/blob_subdir/blobtest_subdir.txt.h"

void blob_print(void)

Check failure on line 13 in tests/build_system/src_folders/blob/blob_test.c

View workflow job for this annotation

GitHub Actions / static-tests

trailing whitespace.
{
print((char *)blobtest_subdir_txt, blobtest_subdir_txt_len);
print("\n", 1);
}
15 changes: 15 additions & 0 deletions tests/build_system/src_folders/folder/a.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (C) 2023 TU Dresden
* Copyright (C) 2024 Orange
*
* 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.
*/

#include <stdio.h>

void folder_a(void)
{
puts("./folder/a.c");
}
15 changes: 15 additions & 0 deletions tests/build_system/src_folders/folder/subfolder/b.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (C) 2023 TU Dresden
* Copyright (C) 2024 Orange
*
* 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.
*/

#include <stdio.h>

void folder_b(void)
{
puts("./folder/subfolder/b.c");
}
46 changes: 46 additions & 0 deletions tests/build_system/src_folders/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (C) 2024 Orange
*
* 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 proving SRC subfolders compatibility with RIOT.
*

Check failure on line 16 in tests/build_system/src_folders/main.c

View workflow job for this annotation

GitHub Actions / static-tests

trailing whitespace.
* @author Pierre Le Meur <pierre1.lemeur@orange.com>
*
*
* @}
*/

#include <stdio.h>

void module_a(void);
void module_b(void);
void folder_a(void);
void folder_b(void);
void blob_print(void);

int main(void)
{
puts("./main.c");

Check failure on line 34 in tests/build_system/src_folders/main.c

View workflow job for this annotation

GitHub Actions / static-tests

trailing whitespace.
/* call functions from RIOT module */
module_a();
module_b();
/* call functions from subfolder */
folder_a();
folder_b();

/* blob test */
blob_print();

return 0;
}
3 changes: 3 additions & 0 deletions tests/build_system/src_folders/module_testing/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MODULE := my_module

include $(RIOTBASE)/Makefile.base
16 changes: 16 additions & 0 deletions tests/build_system/src_folders/module_testing/a.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (C) 2023 TU Dresden
* Copyright (C) 2024 Orange
*
* 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.
*/


#include <stdio.h>

void module_a(void)
{
puts("./module_testing/a.c");
}
15 changes: 15 additions & 0 deletions tests/build_system/src_folders/module_testing/b.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (C) 2023 TU Dresden
* Copyright (C) 2024 Orange
*
* 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.
*/

#include <stdio.h>

void module_b(void)
{
puts("./module_testing/b.c");
}

0 comments on commit 62ff1f9

Please sign in to comment.