Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit 96f7415

Browse files
castulojosuedhg
authored andcommitted
Initial commit with Library code, testing, examples and documentation
Signed-off-by: Josue David Hernandez Gutierrez <[email protected]> Signed-off-by: Castulo J. Martinez <[email protected]>
0 parents  commit 96f7415

File tree

160 files changed

+35073
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+35073
-0
lines changed

.github/builder/action.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: 'USB I3C* Library for Linux* OS Builder'
2+
description: 'Builds and test the USB I3C* Library for Linux* OS'
3+
inputs:
4+
path:
5+
description: 'Directory in the GitHub workspace where the source files can be found'
6+
required: true
7+
coverage_threshold:
8+
description: 'The minimum unit test coverage percentage that is acceptable for the project'
9+
required: true
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- run: ${{ github.action_path }}/run_unit_test.sh ${{ inputs.path }} ${{ inputs.coverage_threshold }}
14+
shell: bash

.github/builder/run_unit_test.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
SRC_PATH=$1
6+
COVERAGE_THRESHOLD=$2
7+
8+
if [ -z "$SRC_PATH" ]; then
9+
echo "SRC_PATH not defined!"
10+
exit 1
11+
fi
12+
13+
if [ -z "$COVERAGE_THRESHOLD" ]; then
14+
echo "COVERAGE_THRESHOLD not defined!"
15+
exit 1
16+
fi
17+
18+
pushd "$SRC_PATH"
19+
20+
rm -fR build
21+
mkdir build
22+
23+
# Run the tests in Release mode and check code coverage
24+
# and code style (the coverage target runs all unit tests)
25+
cmake -DBUILD_TESTS=ON -DCOVERAGE=ON -DDOCUMENTATION=ON -DBUILD_SAMPLES=ON -DCMAKE_BUILD_TYPE=Debug -B build/
26+
cmake --build build/ -- -j6
27+
cmake --build build/ --target coverage
28+
cmake --build build/ --target check_style
29+
30+
# Make sure unit test coverage doesn't fall below the predefined threshold
31+
function_coverage=$(lcov --summary build/coverage/coverage.info | grep functions | cut -c 16-17)
32+
line_coverage=$(lcov --summary build/coverage/coverage.info | grep lines | cut -c 16-17)
33+
echo "The current function coverage is $(lcov --summary build/coverage/coverage.info | grep functions | cut -c 16-19)%"
34+
if [ "$function_coverage" -lt "$COVERAGE_THRESHOLD" ]; then
35+
echo "The current function coverage falls below the $COVERAGE_THRESHOLD% threshold."
36+
exit 1
37+
fi
38+
echo "The current line coverage is $(lcov --summary build/coverage/coverage.info | grep lines | cut -c 16-19)%"
39+
if [ "$line_coverage" -lt "$COVERAGE_THRESHOLD" ]; then
40+
echo "The current line coverage falls below the $COVERAGE_THRESHOLD% threshold."
41+
exit 1
42+
fi
43+
44+
# Copy the coverage directory so we don't loose it
45+
rm -rf ./coverage
46+
cp -r build/coverage .
47+
48+
# Running the various code sanitizers
49+
# -----------------------------------
50+
clean_and_build() {
51+
rm -fR build
52+
mkdir build
53+
cmake -DBUILD_TESTS=ON -DDOCUMENTATION=OFF -DBUILD_SAMPLES=OFF -DCMAKE_BUILD_TYPE="$1" -B build/
54+
cmake --build build/ -- -j6
55+
}
56+
57+
run_tests() {
58+
cmake --build build/ --target unit_test
59+
}
60+
61+
echo -e "\nRunning the UndefinedBehaviorSanitizer...\n"
62+
clean_and_build ubsan
63+
run_tests
64+
65+
echo -e "\nRunning the LeakSanitizer...\n"
66+
clean_and_build lsan
67+
run_tests
68+
69+
echo -e "\nRunning the AddressSanitizer...\n"
70+
clean_and_build asan
71+
run_tests
72+
73+
echo -e "\nRunning the ThreadSanitizer...\n"
74+
clean_and_build tsan
75+
run_tests
76+
77+
popd

.github/workflows/pr.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Validate Pull Request
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build_package:
7+
name: Build job
8+
runs-on: [self-hosted, runner1]
9+
steps:
10+
- id: cleanup_workspace
11+
name: Cleanup workspace for the job (self hosted only)
12+
run: |
13+
rm -fr *
14+
- id: checkout_self
15+
name: Check out PR
16+
uses: actions/checkout@v2
17+
with:
18+
path: src
19+
- id: build_and_test
20+
name: Build and test
21+
uses: ./src/.github/builder
22+
with:
23+
path: src
24+
coverage_threshold: 95

.gitignore

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
## https://github.com/github/gitignore/blob/master/CMake.gitignore
2+
CMakeLists.txt.user
3+
CMakeCache.txt
4+
CMakeFiles
5+
CMakeScripts
6+
Testing
7+
Makefile
8+
cmake_install.cmake
9+
install_manifest.txt
10+
compile_commands.json
11+
CTestTestfile.cmake
12+
_deps
13+
build
14+
15+
## https://github.com/github/gitignore/blob/master/C.gitignore
16+
# Prerequisites
17+
*.d
18+
19+
# Object files
20+
*.o
21+
*.ko
22+
*.obj
23+
*.elf
24+
25+
# Linker output
26+
*.ilk
27+
*.map
28+
*.exp
29+
30+
# Precompiled Headers
31+
*.gch
32+
*.pch
33+
34+
# Libraries
35+
*.lib
36+
*.a
37+
*.la
38+
*.lo
39+
40+
# Shared objects (inc. Windows DLLs)
41+
*.dll
42+
*.so
43+
*.so.*
44+
*.dylib
45+
46+
# Executables
47+
*.exe
48+
*.out
49+
*.app
50+
*.i*86
51+
*.x86_64
52+
*.hex
53+
54+
# Debug files
55+
*.dSYM/
56+
*.su
57+
*.idb
58+
*.pdb
59+
60+
# Kernel Module Compile Results
61+
*.mod*
62+
*.cmd
63+
.tmp_versions/
64+
modules.order
65+
Module.symvers
66+
Mkfile.old
67+
dkms.conf
68+
.cache/
69+
.clangd

AUTHORS

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Current Maintainers
2+
-------------------
3+
4+
The **USB I3C\* Library for Linux\* OS** is looking for maintainers.
5+
6+
7+
Past Maintainers
8+
----------------
9+
10+
Josue David Hernandez <[email protected]> (until 12/2022)
11+
Castulo Martinez <[email protected]> (until 12/2022)
12+
13+
14+
Contributors
15+
------------
16+
17+
Brett T Warden <[email protected]>

0 commit comments

Comments
 (0)