├── doxygen-generation ├── template │ ├── _config.yml │ ├── _layouts │ │ └── default.html │ └── index.md └── action.yml ├── sbom-generator ├── requirements.txt ├── action.yml └── sbom_utils.py ├── localhost-http-1.1-server ├── requirements.txt ├── action.yml └── localhost_http_1.1_server.py ├── ssl-credential-creator ├── requirements.txt ├── action.yml └── ssl_credential_creator.py ├── executable-monitor ├── requirements.txt ├── README.md ├── test.c └── action.yml ├── manifest-verifier ├── requirements.txt └── action.yml ├── localhost-mqtt-broker ├── requirements.txt ├── action.yml └── localhost_mqtt_broker.py ├── rust-spell-check ├── crates │ └── libaspell-sys │ │ ├── wrapper.h │ │ ├── src │ │ └── lib.rs │ │ ├── Cargo.toml │ │ └── build.rs ├── queries │ ├── c.scm │ └── python.scm ├── Cargo.toml └── action.yml ├── .gitattributes ├── memory_statistics ├── test │ ├── testdir │ │ └── empty.c │ ├── include │ │ └── test_header.h │ ├── memory_statistics_config.json │ ├── test.c │ └── size_table_expected.html ├── makefile ├── paths.json └── action.yml ├── formatting ├── filesWithTrailingWhitespace │ ├── fileWithTrailingWhitespaceWithDifferentExtension.log │ └── testWithTrailingWhitespace.c ├── README.md ├── goodFiles │ ├── include │ │ ├── goodHeader.h │ │ ├── fileWithErrorInclude │ │ │ ├── goodHeader.h │ │ │ ├── goodHeaderTwo.h │ │ │ └── errorFileInDirectory.h │ │ ├── formatErrorTest.h │ │ └── goodHeaderTwo.h │ └── source │ │ ├── README.md │ │ ├── formatErrorTest.c │ │ ├── goodSource.c │ │ ├── goodSourceTwo.c │ │ ├── fileWithErrorSource │ │ ├── errorFileInDirectory.c │ │ └── goodTest.c │ │ └── goodSourceThree.c ├── filesWithCRLFEndings │ ├── fileWithCRLFEnding.h │ ├── fileWithCRLFEndingWithDifferentExtension.txt │ └── testWithCRLFEnding.c └── filesWithFormattingErrors │ ├── testWithFormattingError.c │ └── goodFileInHere.c ├── .gitignore ├── clang-formatting ├── filesWithTrailingWhitespace │ ├── fileWithTrailingWhitespaceWithDifferentExtension.log │ └── testWithTrailingWhitespace.c ├── README.md ├── goodFiles │ ├── include │ │ ├── goodHeader.h │ │ ├── fileWithErrorInclude │ │ │ ├── goodHeader.h │ │ │ ├── goodHeaderTwo.h │ │ │ └── errorFileInDirectory.h │ │ ├── formatErrorTest.h │ │ └── goodHeaderTwo.h │ └── source │ │ ├── README.md │ │ ├── goodSource.c │ │ ├── goodSourceTwo.c │ │ ├── goodSourceThree.c │ │ ├── fileWithErrorSource │ │ ├── goodTest.c │ │ └── errorFileInDirectory.c │ │ └── formatErrorTest.c ├── filesWithCRLFEndings │ ├── fileWithCRLFEnding.h │ ├── fileWithCRLFEndingWithDifferentExtension.txt │ └── testWithCRLFEnding.c ├── filesWithFormattingErrors │ ├── goodFileInHere.c │ └── testWithFormattingError.c └── .clang-format ├── link-verifier ├── badUrls.md ├── requirements.txt ├── fileTests │ ├── goodFiles │ │ ├── fileWithMDIntheName.md │ │ ├── fileWithMDIntheName.txt │ │ └── fileWithLowercasemdIntheName.md │ └── badFiles │ │ ├── fileWithMDIntheNameAndABrokenLink.md │ │ ├── fileWithMDIntheNameAndABrokenLink.txt │ │ └── fileWithLowercasemdIntheNameAndABrokenLink.md ├── README.md ├── action.yml └── trusted_certs │ └── ca_bundle.crt ├── SECURITY.md ├── spellings ├── cspell.config.yaml └── action.yml ├── localhost-echo-server ├── action.yml └── local_echo_server.py ├── LICENSE ├── complexity └── action.yml ├── doxygen ├── action.yml └── generate_doxygen.py ├── artifact-backup └── action.yml ├── README.md └── run_cbmc └── action.yml /doxygen-generation/template/_config.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sbom-generator/requirements.txt: -------------------------------------------------------------------------------- 1 | pyyaml 2 | -------------------------------------------------------------------------------- /localhost-http-1.1-server/requirements.txt: -------------------------------------------------------------------------------- 1 | pyOpenSSL -------------------------------------------------------------------------------- /ssl-credential-creator/requirements.txt: -------------------------------------------------------------------------------- 1 | pyOpenSSL 2 | -------------------------------------------------------------------------------- /executable-monitor/requirements.txt: -------------------------------------------------------------------------------- 1 | pyyaml 2 | gitpython -------------------------------------------------------------------------------- /manifest-verifier/requirements.txt: -------------------------------------------------------------------------------- 1 | pyyaml 2 | gitpython -------------------------------------------------------------------------------- /localhost-mqtt-broker/requirements.txt: -------------------------------------------------------------------------------- 1 | amqtt==0.10.1 2 | pyOpenSSL 3 | -------------------------------------------------------------------------------- /rust-spell-check/crates/libaspell-sys/wrapper.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /rust-spell-check/queries/c.scm: -------------------------------------------------------------------------------- 1 | (comment) @comment 2 | (string_literal) @string 3 | -------------------------------------------------------------------------------- /rust-spell-check/queries/python.scm: -------------------------------------------------------------------------------- 1 | (comment) @comment 2 | (string) @string 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | formatting/filesWithCRLFEndings/* eol=crlf 2 | clang-formatting/filesWithCRLFEndings/* eol=crlf 3 | -------------------------------------------------------------------------------- /memory_statistics/test/testdir/empty.c: -------------------------------------------------------------------------------- 1 | /* Test if an empty file works. 2 | * Objects smaller than .1kb should be rounded up. */ 3 | -------------------------------------------------------------------------------- /formatting/filesWithTrailingWhitespace/fileWithTrailingWhitespaceWithDifferentExtension.log: -------------------------------------------------------------------------------- 1 | I am a file 2 | With trailing whitespace 3 | On random lines 4 | 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.out 2 | logDir/ 3 | demo_run_logs/ 4 | rust-spell-check/target/ 5 | rust-spell-check/debug/ 6 | # Ignore any helper scripts people are writing while working 7 | *.sh 8 | -------------------------------------------------------------------------------- /clang-formatting/filesWithTrailingWhitespace/fileWithTrailingWhitespaceWithDifferentExtension.log: -------------------------------------------------------------------------------- 1 | I am a file 2 | With trailing whitespace 3 | On random lines 4 | 5 | 6 | -------------------------------------------------------------------------------- /link-verifier/badUrls.md: -------------------------------------------------------------------------------- 1 | https://dummy-url.com/ota.bin 2 | https://dummy-url.com/ota.com 3 | https://dummy-url-three.com/ota.bin 4 | https://www.gnu.org/software/complexity/manual/complexity.html 5 | -------------------------------------------------------------------------------- /rust-spell-check/crates/libaspell-sys/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![allow(non_upper_case_globals)] 2 | #![allow(non_camel_case_types)] 3 | #![allow(non_snake_case)] 4 | 5 | include!(concat!(env!("OUT_DIR"), "/bindings.rs")); 6 | -------------------------------------------------------------------------------- /link-verifier/requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4==4.9.3 2 | bs4==0.0.1 3 | certifi==2024.7.4 4 | chardet==3.0.4 5 | idna==3.7 6 | requests==2.32.4 7 | soupsieve==2.1 8 | termcolor==1.1.0 9 | urllib3>=2.0.7 10 | -------------------------------------------------------------------------------- /memory_statistics/test/include/test_header.h: -------------------------------------------------------------------------------- 1 | /** 2 | * test_header.h 3 | * This is an empty header file to test that the memory_statistics action uses 4 | * include directories from the provided config file. 5 | */ 6 | -------------------------------------------------------------------------------- /rust-spell-check/crates/libaspell-sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "libaspell-sys" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | 8 | [build-dependencies] 9 | bindgen = "0.59.2" 10 | -------------------------------------------------------------------------------- /memory_statistics/test/memory_statistics_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "lib_name": "Memory Statistics Test", 3 | "src": [ 4 | "test.c", 5 | {"file": "testdir/empty.c", "tag": "tagged"} 6 | ], 7 | "include": [ 8 | "include" 9 | ], 10 | "compiler_flags": [ 11 | "TEST_FLAG" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | ## Reporting a Vulnerability 2 | 3 | If you discover a potential security issue in this project, we ask that you notify AWS/Amazon Security 4 | via our [vulnerability reporting page](https://aws.amazon.com/security/vulnerability-reporting/) or directly via email to aws-security@amazon.com. 5 | Please do **not** create a public github issue. 6 | -------------------------------------------------------------------------------- /link-verifier/fileTests/goodFiles/fileWithMDIntheName.md: -------------------------------------------------------------------------------- 1 | # I am a test file to make sure the regex name replacement only 2 | # replaces files that end in .md, not all files with md in their name. 3 | # Here's a random link for it to test as well 4 | [verify-links.py](../../verify-links.py) 5 | [CI-CD-Github-Actions](https://github.com/FreeRTOS/CI-CD-Github-Actions) 6 | -------------------------------------------------------------------------------- /doxygen-generation/template/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{ site.data.doc_config.name }} Documentation 8 | 9 | 10 | {{ content }} 11 | 12 | 13 | -------------------------------------------------------------------------------- /link-verifier/fileTests/goodFiles/fileWithMDIntheName.txt: -------------------------------------------------------------------------------- 1 | # I am a test file to make sure the regex name replacement only replaces files 2 | # that end in .md, not all files with md in their name. 3 | # As this would cause the python script to fail 4 | 5 | # When using the default input 6 | # Here are two links that exist 7 | [verify-links.py](../../verify-links.py) 8 | [CI-CD-Github-Actions](https://github.com/FreeRTOS/CI-CD-Github-Actions] 9 | -------------------------------------------------------------------------------- /memory_statistics/makefile: -------------------------------------------------------------------------------- 1 | # Required variables: 2 | # SRCS: source files to measure 3 | # CFLAGS: Flags nessesary, such as include directories 4 | 5 | CC=arm-none-eabi-gcc 6 | override CFLAGS+=-std=gnu99 -ggdb -DNDEBUG 7 | override CFLAGS+=-mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 8 | 9 | OBJS=$(SRCS:.c=.o) 10 | 11 | .PHONY: size clean 12 | 13 | size: $(OBJS) 14 | arm-none-eabi-size -B $(OBJS) 15 | 16 | clean: 17 | rm -rf $(OBJS) 18 | -------------------------------------------------------------------------------- /rust-spell-check/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "spell-checker" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | tree-sitter = "0.20.4" 8 | tree-sitter-c = "0.20.1" 9 | tree-sitter-cpp = "0.20.0" 10 | tree-sitter-python = "0.19.1" 11 | libaspell-sys = { path = "crates/libaspell-sys" } 12 | cstr = "0.2.10" 13 | clap = { version = "3.1.2", features = ["derive"] } 14 | 15 | [workspace] 16 | members = ["crates/libaspell-sys"] 17 | 18 | [profile.release] 19 | lto = "thin" 20 | panic = "abort" 21 | -------------------------------------------------------------------------------- /doxygen-generation/template/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | # {{ site.data.doc_config.name }} Documentation 4 | 5 | API reference documentation is available for the following releases: 6 | 7 | {% for release in site.data.doc_config.releases %} 8 | - [{{ release }} documentation]({{ release }}) 9 | {% endfor %} 10 | 11 | API reference documentation is available for the following branches: 12 | 13 | {% for branch in site.data.doc_config.branches %} 14 | - [{{ branch }} branch documentation]({{ branch }}) 15 | {% endfor %} 16 | -------------------------------------------------------------------------------- /link-verifier/fileTests/goodFiles/fileWithLowercasemdIntheName.md: -------------------------------------------------------------------------------- 1 | # I am a test file to make sure the regex name replacement only 2 | # replaces files that end in .md, not all files with md in their name. 3 | # Here's a random link for it to test as well 4 | [verify-links.py](../../verify-links.py) 5 | [CI-CD-Github-Actions](https://github.com/FreeRTOS/CI-CD-Github-Actions) 6 | # Test that it will find this url 7 | https://www.google.com 8 | # Test that it will find this url and drop the slash 9 | https://www.google.com/ 10 | # Test that it will find this url by dropping the coma 11 | https://www.google.com, 12 | -------------------------------------------------------------------------------- /memory_statistics/test/test.c: -------------------------------------------------------------------------------- 1 | #include "stdint.h" 2 | 3 | /* Test include directories added from supplied memory_statistics config. 4 | * This header is in ./include which is in the config for testing the 5 | * memory_statistics action. */ 6 | #include "test_header.h" 7 | 8 | /* Test compiler flags added from supplied memory_statistics config. 9 | * TEST_FLAG is in the compiler_flags array of the config for testing the 10 | * memory_statistics action. */ 11 | #ifdef TEST_FLAG 12 | 13 | /* This should add 10340 bytes to the .text section. 14 | * The result should be memory_statistics reporting 10.1K for this file. */ 15 | const uint8_t array[ 10340 ] = { 1 }; 16 | #endif 17 | -------------------------------------------------------------------------------- /rust-spell-check/crates/libaspell-sys/build.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | use std::path::PathBuf; 3 | 4 | fn main() { 5 | println!("cargo:rustc-link-lib=aspell"); 6 | println!("cargo:rerun-if-changed=wrapper.h"); 7 | 8 | let bindings = bindgen::Builder::default() 9 | .header("wrapper.h").clang_arg("-I/opt/homebrew/Cellar/aspell/0.60.8/include/") 10 | .parse_callbacks(Box::new(bindgen::CargoCallbacks)) 11 | .generate() 12 | .expect("Unable to generate bindings"); 13 | 14 | let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); 15 | bindings 16 | .write_to_file(out_path.join("bindings.rs")) 17 | .expect("Couldn't write bindings!"); 18 | } 19 | -------------------------------------------------------------------------------- /link-verifier/fileTests/badFiles/fileWithMDIntheNameAndABrokenLink.md: -------------------------------------------------------------------------------- 1 | # I am a test file to make sure the regex name replacement only replaces files 2 | # that end in .md, not all files with md in their name. 3 | # I also exit to make sure we skip files that don't end in .[c, h, dox, md, html] 4 | # When using the default input 5 | # Here are two links that exist 6 | [verify-links.py](../../verify-links.py) 7 | [CI-CD-Github-Actions](https://github.com/FreeRTOS/CI-CD-Github-Actions] 8 | 9 | # Here's a link that doesn't exist that should cause us to fail if searched 10 | # But since we aren't searched by default this broken link should not cause an error 11 | [Incredible link](https://github.com/FreeRTOS/A-Repo-That-Wins-You-The-Lottery) 12 | -------------------------------------------------------------------------------- /link-verifier/fileTests/badFiles/fileWithMDIntheNameAndABrokenLink.txt: -------------------------------------------------------------------------------- 1 | # I am a test file to make sure the regex name replacement only replaces files 2 | # that end in .md, not all files with md in their name. 3 | # I also exit to make sure we skip files that don't end in .[c, h, dox, md, html] 4 | # When using the default input 5 | # Here are two links that exist 6 | [verify-links.py](../../verify-links.py) 7 | [CI-CD-Github-Actions](https://github.com/FreeRTOS/CI-CD-Github-Actions] 8 | 9 | # Here's a link that doesn't exist that should cause us to fail if searched 10 | # But since we aren't searched by default this broken link should not cause an error 11 | [Incredible link](https://github.com/FreeRTOS/A-Repo-That-Wins-You-The-Lottery) 12 | -------------------------------------------------------------------------------- /link-verifier/fileTests/badFiles/fileWithLowercasemdIntheNameAndABrokenLink.md: -------------------------------------------------------------------------------- 1 | # I am a test file to make sure the regex name replacement only replaces files 2 | # that end in .md, not all files with md in their name. 3 | # I also exit to make sure we skip files that don't end in .[c, h, dox, md, html] 4 | # When using the default input 5 | # Here are two links that exist 6 | [verify-links.py](../../verify-links.py) 7 | [CI-CD-Github-Actions](https://github.com/FreeRTOS/CI-CD-Github-Actions] 8 | 9 | # Here's a link that doesn't exist that should cause us to fail if searched 10 | # But since we aren't searched by default this broken link should not cause an error 11 | [Incredible link](https://github.com/FreeRTOS/A-Repo-That-Wins-You-The-Lottery) 12 | -------------------------------------------------------------------------------- /sbom-generator/action.yml: -------------------------------------------------------------------------------- 1 | name: 'generate-sbom' 2 | description: 'Generate SBOM for FreeRTOS libraries' 3 | inputs: 4 | repo_path: 5 | description: 'Path to repository folder containing manifest.yml to verify.' 6 | required: false 7 | default: ./ 8 | source_path: 9 | description: 'Path to source code' 10 | required: false 11 | default: ./source 12 | runs: 13 | using: "composite" 14 | steps: 15 | - name: Install dependencies 16 | shell: bash 17 | run: pip install -r $GITHUB_ACTION_PATH/requirements.txt 18 | 19 | - name: Run generator script 20 | working-directory: ${{ inputs.repo_path }} 21 | shell: bash 22 | run: | 23 | python3 $GITHUB_ACTION_PATH/scan_dir.py --source-path ${{ inputs.source_path }} 24 | -------------------------------------------------------------------------------- /spellings/cspell.config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | $schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json 3 | version: '0.2' 4 | # Allows things like stringLength 5 | allowCompoundWords: true 6 | 7 | # Read files not to spell check from the git ignore 8 | useGitignore: true 9 | 10 | # Language settings for C 11 | languageSettings: 12 | - caseSensitive: false 13 | enabled: true 14 | languageId: c 15 | locale: "*" 16 | 17 | # Add a dictionary, and the path to the word list 18 | dictionaryDefinitions: 19 | - name: freertos-words 20 | path: '.github/.cSpellWords.txt' 21 | addWords: true 22 | 23 | dictionaries: 24 | - freertos-words 25 | 26 | # Paths and files to ignore 27 | ignorePaths: 28 | - 'dependency' 29 | - 'docs' 30 | - 'ThirdParty' 31 | - 'History.txt' 32 | -------------------------------------------------------------------------------- /localhost-echo-server/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Localhost Echo Server' 2 | description: 'Starts an echo server using Python.' 3 | 4 | inputs: 5 | host_address: 6 | description: "Host address for echo server." 7 | required: false 8 | default: "127.0.0.1" 9 | port_number: 10 | description: "Port for echo server." 11 | required: True 12 | 13 | runs: 14 | using: "composite" 15 | steps: 16 | - name: Run localhost Echo server 17 | shell: bash 18 | run: | 19 | python3 --version 20 | # Use the host_address input if provided, otherwise default to 127.0.0.1 21 | HOST=${{ inputs.host_address }} 22 | if [[ -z "$HOST" ]]; then 23 | HOST="127.0.0.1" 24 | fi 25 | python3 $GITHUB_ACTION_PATH/local_echo_server.py --host=$HOST --port_number=${{ inputs.port_number }} & 26 | 27 | -------------------------------------------------------------------------------- /memory_statistics/test/size_table_expected.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
Code Size of Memory Statistics Test (example generated with GCC for ARM Cortex-M)
File
With -O1 Optimization
With -Os Optimization
test.c
10.1K
10.1K
empty.c (tagged)
0.1K
0.1K
Total estimates
10.2K
10.2K
26 | -------------------------------------------------------------------------------- /localhost-http-1.1-server/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Localhost HTTP Server' 2 | description: 'Starts an HTTP 1.1 server using Python. For TLS connections (including mutual authentication), connect to localhost:4443. For plaintext connections, connect to localhost:8080.' 3 | 4 | inputs: 5 | root-ca-cert-path: 6 | description: "Root CA certificate file path." 7 | required: True 8 | server-cert-path: 9 | description: "Server certificate file path." 10 | required: True 11 | server-priv-key-path: 12 | description: "Server private key file path." 13 | required: True 14 | 15 | runs: 16 | using: "composite" 17 | steps: 18 | - name: Install dependencies 19 | run: pip install -r $GITHUB_ACTION_PATH/requirements.txt 20 | shell: bash 21 | 22 | - name: Run localhost HTTP broker 23 | run: python3 $GITHUB_ACTION_PATH/localhost_http_1.1_server.py --root-ca-cert-path=${{ inputs.root-ca-cert-path }} --server-priv-key-path=${{ inputs.server-priv-key-path }} --server-cert-path=${{ inputs.server-cert-path }} & 24 | shell: bash 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /memory_statistics/paths.json: -------------------------------------------------------------------------------- 1 | { 2 | "coreMQTT": { 3 | "path": "FreeRTOS-Plus/Source/Application-Protocols/coreMQTT" 4 | }, 5 | "coreMQTTAgent": { 6 | "path": "FreeRTOS-Plus/Source/Application-Protocols/coreMQTT-Agent" 7 | }, 8 | "coreHTTP": { 9 | "path": "FreeRTOS-Plus/Source/Application-Protocols/coreHTTP" 10 | }, 11 | "coreJSON": { 12 | "path": "FreeRTOS-Plus/Source/coreJSON" 13 | }, 14 | "corePKCS11": { 15 | "path": "FreeRTOS-Plus/Source/corePKCS11" 16 | }, 17 | "coreSNTP": { 18 | "path": "FreeRTOS-Plus/Source/Application-Protocols/coreSNTP" 19 | }, 20 | "shadow": { 21 | "path": "FreeRTOS-Plus/Source/AWS/device-shadow" 22 | }, 23 | "jobs": { 24 | "path": "FreeRTOS-Plus/Source/AWS/jobs" 25 | }, 26 | "defender": { 27 | "path": "FreeRTOS-Plus/Source/AWS/device-defender" 28 | }, 29 | "backoffalgorithm": { 30 | "path": "FreeRTOS-Plus/Source/Utilities/backoff_algorithm" 31 | }, 32 | "ota": { 33 | "path": "FreeRTOS-Plus/Source/AWS/ota" 34 | }, 35 | "sigv4": { 36 | "path": "FreeRTOS-Plus/Source/AWS/sigv4" 37 | }, 38 | "fleetprovisioning": { 39 | "path": "FreeRTOS-Plus/Source/AWS/fleet-provisioning" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /localhost-mqtt-broker/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Localhost MQTT Broker' 2 | description: 'Starts an MQTT Broker using Python. For TLS connections (including mutual authentication), connect to localhost:8883. For plaintext connections, connect to localhost:1883.' 3 | 4 | inputs: 5 | host_address: 6 | description: "Host address for echo server." 7 | required: false 8 | default: "127.0.0.1" 9 | root-ca-cert-path: 10 | description: "Root CA certificate file path." 11 | required: True 12 | server-cert-path: 13 | description: "Server certificate file path." 14 | required: True 15 | server-priv-key-path: 16 | description: "Server private key file path." 17 | required: True 18 | 19 | runs: 20 | using: "composite" 21 | steps: 22 | - name: Install dependencies 23 | run: pip install -r $GITHUB_ACTION_PATH/requirements.txt 24 | shell: bash 25 | - name: Run localhost MQTT broker 26 | run: | 27 | python3 --version 28 | # Use the host_address input if provided, otherwise default to 127.0.0.1 29 | HOST=${{ inputs.host_address }} 30 | if [[ -z "$HOST" ]]; then 31 | HOST="127.0.0.1" 32 | fi 33 | python3 $GITHUB_ACTION_PATH/localhost_mqtt_broker.py --host=$HOST --root-ca-cert-path=${{ inputs.root-ca-cert-path }} --server-priv-key-path=${{ inputs.server-priv-key-path }} --server-cert-path=${{ inputs.server-cert-path }} & 34 | shell: bash 35 | -------------------------------------------------------------------------------- /localhost-echo-server/local_echo_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import asyncio 4 | import logging 5 | import os 6 | from argparse import ArgumentParser 7 | 8 | logger = logging.getLogger('echoserver') 9 | 10 | async def echo_handler(reader, writer): 11 | address = writer.get_extra_info('peername') 12 | logger.debug('accept: %s', address) 13 | message = await reader.readline() 14 | writer.write(message) 15 | await writer.drain() 16 | writer.close() 17 | 18 | if __name__ == '__main__': 19 | parser = ArgumentParser(description='Localhost Echo server.') 20 | parser.add_argument('--host', 21 | type=str, 22 | required=True, 23 | help='Host address for the echo server.') 24 | parser.add_argument('--port_number', 25 | type=int, 26 | required=True, 27 | help='Port for echo server.') 28 | args = parser.parse_args() 29 | logging.basicConfig() 30 | logger.setLevel(logging.DEBUG) 31 | loop = asyncio.new_event_loop() 32 | asyncio.set_event_loop(loop) 33 | factory = asyncio.start_server( 34 | echo_handler, 35 | os.environ.get('HOST', args.host), 36 | os.environ.get('PORT', args.port_number) 37 | ) 38 | server = loop.run_until_complete(factory) 39 | try: 40 | loop.run_forever() 41 | except KeyboardInterrupt: 42 | pass 43 | server.close() 44 | loop.run_until_complete(server.wait_closed()) 45 | loop.close() 46 | -------------------------------------------------------------------------------- /formatting/README.md: -------------------------------------------------------------------------------- 1 | # Uncrustify Format GitHub Action 2 | ## Purpose 3 | This directory contains an [action.yml](action.yml) file to uncrustify code 4 | files inside of [FreeRTOS](https://github.com/FreeRTOS/) repositories. It 5 | additionally will check for files with trailing whitespace, and CRLF line 6 | endings. 7 | 8 | If a file is found that contains incorrect formatting, trailing whitespace, or 9 | CRLF endings, this action will create a Git Patch that will be added to the 10 | summary of the workflow run that uses this action. This allows an end user to 11 | download the patch, apply it, and then pass the formatting checks. 12 | 13 | A patch is provided, instead of automatically applying the updates, as 14 | automatically formatting files could lead to merge conflicts. If an end-user 15 | didn't know they need to perform a `git pull` as their origin would have the 16 | formatting change applied. 17 | 18 | ## Testing Files 19 | This directory contains many files that are used to test the action. 20 | These tests can be found inside of 21 | [formattingTests.yml](../.github/workflows/formattingTests.yml). 22 | The files have been named in such a way to explain what their purpose is. 23 | The general idea is that there are a mix of files, some with CRLF endings, 24 | some with uncrustify errors, and some with trailing whitespace. Where the 25 | inside of 26 | [formattingTests.yml](../.github/workflows/formattingTests.yml) 27 | these various files are checked to ensure this action properly fails when 28 | a formatting issue is discovered. Additional tests are here to ensure that 29 | the various input parameters to the action work as intended. 30 | -------------------------------------------------------------------------------- /clang-formatting/README.md: -------------------------------------------------------------------------------- 1 | # Clang-Format GithubAction 2 | ## Purpose 3 | This directory contains an [action.yml](action.yml) file to clang-format code 4 | files inside of [FreeRTOS](https://github.com/FreeRTOS/) repositories. It 5 | additionally will check for files with trailing whitespace, and CRLF line 6 | endings. 7 | 8 | If a file is found that contains incorrect formatting, trailing whitespace, or 9 | CRLF endings, this action will create a Git Patch that will be added to the 10 | summary of the workflow run that uses this action. This allows an end user to 11 | download the patch, apply it, and then pass the formatting checks. 12 | 13 | A patch is provided, instead of automatically applying the updates, as 14 | automatically formatting files could lead to merge conflicts. If an end-user 15 | didn't know they need to perform a `git pull` as their origin would have the 16 | formatting change applied. 17 | 18 | ## Testing Files 19 | This directory contains many files that are used to test the action. 20 | These tests can be found inside of 21 | [formattingTests.yml](../.github/workflows/formattingTests.yml). 22 | The files have been named in such a way to explain what their purpose is. 23 | The general idea is that there are a mix of files, some with CRLF endings, 24 | some with clang-format errors, and some with trailing whitespace. Where the 25 | inside of 26 | [formattingTests.yml](../.github/workflows/formattingTests.yml) 27 | these various files are checked to ensure this action properly fails when 28 | a formatting issue is discovered. Additional tests are here to ensure that 29 | the various input parameters to the action work as intended. 30 | -------------------------------------------------------------------------------- /clang-formatting/goodFiles/include/goodHeader.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | /* Error checking macros for the clock selction and clock enable defines */ 5 | 6 | #if( ( CLK_SOURCE != CLK_SOURCE_LOCO ) && ( CLK_SOURCE != CLK_SOURCE_HOCO ) && \ 7 | ( CLK_SOURCE != CLK_SOURCE_MAIN ) && ( CLK_SOURCE != CLK_SOURCE_SUB ) && \ 8 | ( CLK_SOURCE != CLK_SOURCE_PLL ) ) 9 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 10 | #endif 11 | 12 | #if( CLK_SOURCE == CLK_SOURCE_HOCO ) && ( ENABLE_HOCO == 0 ) 13 | #error \ 14 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 15 | #endif 16 | 17 | #if( CLK_SOURCE == CLK_SOURCE_MAIN ) && ( ENABLE_MAIN == 0 ) 18 | #error \ 19 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 20 | #endif 21 | 22 | #if( CLK_SOURCE == CLK_SOURCE_SUB ) && ( ENABLE_SUB == 0 ) 23 | #error \ 24 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if( CLK_SOURCE == CLK_SOURCE_PLL ) && ( ENABLE_PLL == 0 ) 28 | #error \ 29 | "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" 30 | #endif 31 | 32 | #if( FCLK_FREQUENCY > 50000000L ) 33 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 34 | #endif 35 | 36 | #if( ICLK_FREQUENCY > 100000000L ) 37 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 38 | #endif 39 | 40 | #if( BCLK_FREQUENCY > 100000000L ) 41 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 42 | #endif 43 | 44 | #if( PCLKB_FREQUENCY > 50000000L ) 45 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 46 | #endif 47 | 48 | #endif -------------------------------------------------------------------------------- /formatting/goodFiles/include/goodHeader.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | /* Error checking macros for the clock selction and clock enable defines */ 5 | 6 | #if ( ( CLK_SOURCE != CLK_SOURCE_LOCO ) && ( CLK_SOURCE != CLK_SOURCE_HOCO ) && \ 7 | ( CLK_SOURCE != CLK_SOURCE_MAIN ) && ( CLK_SOURCE != CLK_SOURCE_SUB ) && \ 8 | ( CLK_SOURCE != CLK_SOURCE_PLL ) ) 9 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 10 | #endif 11 | 12 | #if ( CLK_SOURCE == CLK_SOURCE_HOCO ) && ( ENABLE_HOCO == 0 ) 13 | #error \ 14 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 15 | #endif 16 | 17 | #if ( CLK_SOURCE == CLK_SOURCE_MAIN ) && ( ENABLE_MAIN == 0 ) 18 | #error \ 19 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 20 | #endif 21 | 22 | #if ( CLK_SOURCE == CLK_SOURCE_SUB ) && ( ENABLE_SUB == 0 ) 23 | #error \ 24 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if ( CLK_SOURCE == CLK_SOURCE_PLL ) && ( ENABLE_PLL == 0 ) 28 | #error \ 29 | "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" 30 | #endif 31 | 32 | #if ( FCLK_FREQUENCY > 50000000L ) 33 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 34 | #endif 35 | 36 | #if ( ICLK_FREQUENCY > 100000000L ) 37 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 38 | #endif 39 | 40 | #if ( BCLK_FREQUENCY > 100000000L ) 41 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 42 | #endif 43 | 44 | #if ( PCLKB_FREQUENCY > 50000000L ) 45 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 46 | #endif 47 | 48 | #endif /* ifndef CGC_ERROR_H_ */ 49 | -------------------------------------------------------------------------------- /clang-formatting/goodFiles/include/fileWithErrorInclude/goodHeader.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | /* Error checking macros for the clock selction and clock enable defines */ 5 | 6 | #if( ( CLK_SOURCE != CLK_SOURCE_LOCO ) && ( CLK_SOURCE != CLK_SOURCE_HOCO ) && \ 7 | ( CLK_SOURCE != CLK_SOURCE_MAIN ) && ( CLK_SOURCE != CLK_SOURCE_SUB ) && \ 8 | ( CLK_SOURCE != CLK_SOURCE_PLL ) ) 9 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 10 | #endif 11 | 12 | #if( CLK_SOURCE == CLK_SOURCE_HOCO ) && ( ENABLE_HOCO == 0 ) 13 | #error \ 14 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 15 | #endif 16 | 17 | #if( CLK_SOURCE == CLK_SOURCE_MAIN ) && ( ENABLE_MAIN == 0 ) 18 | #error \ 19 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 20 | #endif 21 | 22 | #if( CLK_SOURCE == CLK_SOURCE_SUB ) && ( ENABLE_SUB == 0 ) 23 | #error \ 24 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if( CLK_SOURCE == CLK_SOURCE_PLL ) && ( ENABLE_PLL == 0 ) 28 | #error \ 29 | "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" 30 | #endif 31 | 32 | #if( FCLK_FREQUENCY > 50000000L ) 33 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 34 | #endif 35 | 36 | #if( ICLK_FREQUENCY > 100000000L ) 37 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 38 | #endif 39 | 40 | #if( BCLK_FREQUENCY > 100000000L ) 41 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 42 | #endif 43 | 44 | #if( PCLKB_FREQUENCY > 50000000L ) 45 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 46 | #endif 47 | 48 | #endif -------------------------------------------------------------------------------- /clang-formatting/goodFiles/include/fileWithErrorInclude/goodHeaderTwo.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | /* Error checking macros for the clock selction and clock enable defines */ 5 | 6 | #if( ( CLK_SOURCE != CLK_SOURCE_LOCO ) && ( CLK_SOURCE != CLK_SOURCE_HOCO ) && \ 7 | ( CLK_SOURCE != CLK_SOURCE_MAIN ) && ( CLK_SOURCE != CLK_SOURCE_SUB ) && \ 8 | ( CLK_SOURCE != CLK_SOURCE_PLL ) ) 9 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 10 | #endif 11 | 12 | #if( CLK_SOURCE == CLK_SOURCE_HOCO ) && ( ENABLE_HOCO == 0 ) 13 | #error \ 14 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 15 | #endif 16 | 17 | #if( CLK_SOURCE == CLK_SOURCE_MAIN ) && ( ENABLE_MAIN == 0 ) 18 | #error \ 19 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 20 | #endif 21 | 22 | #if( CLK_SOURCE == CLK_SOURCE_SUB ) && ( ENABLE_SUB == 0 ) 23 | #error \ 24 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if( CLK_SOURCE == CLK_SOURCE_PLL ) && ( ENABLE_PLL == 0 ) 28 | #error \ 29 | "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" 30 | #endif 31 | 32 | #if( FCLK_FREQUENCY > 50000000L ) 33 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 34 | #endif 35 | 36 | #if( ICLK_FREQUENCY > 100000000L ) 37 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 38 | #endif 39 | 40 | #if( BCLK_FREQUENCY > 100000000L ) 41 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 42 | #endif 43 | 44 | #if( PCLKB_FREQUENCY > 50000000L ) 45 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 46 | #endif 47 | 48 | #endif -------------------------------------------------------------------------------- /formatting/filesWithCRLFEndings/fileWithCRLFEnding.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | /* Error checking macros for the clock selction and clock enable defines */ 5 | 6 | #if ( (CLK_SOURCE != CLK_SOURCE_LOCO) && \ 7 | (CLK_SOURCE != CLK_SOURCE_HOCO) && \ 8 | (CLK_SOURCE != CLK_SOURCE_MAIN) && \ 9 | (CLK_SOURCE != CLK_SOURCE_SUB) && \ 10 | (CLK_SOURCE != CLK_SOURCE_PLL) ) 11 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 12 | #endif 13 | 14 | 15 | #if (CLK_SOURCE == CLK_SOURCE_HOCO) && (ENABLE_HOCO == 0) 16 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 17 | #endif 18 | 19 | #if (CLK_SOURCE == CLK_SOURCE_MAIN) && (ENABLE_MAIN == 0) 20 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 21 | #endif 22 | 23 | #if (CLK_SOURCE == CLK_SOURCE_SUB) && (ENABLE_SUB == 0) 24 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if (CLK_SOURCE == CLK_SOURCE_PLL) && (ENABLE_PLL == 0) 28 | #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" 29 | #endif 30 | 31 | #if ( FCLK_FREQUENCY > 50000000L ) 32 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 33 | #endif 34 | 35 | #if ( ICLK_FREQUENCY > 100000000L ) 36 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 37 | #endif 38 | 39 | #if ( BCLK_FREQUENCY > 100000000L ) 40 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 41 | #endif 42 | 43 | #if ( PCLKB_FREQUENCY > 50000000L ) 44 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 45 | #endif 46 | 47 | #endif -------------------------------------------------------------------------------- /clang-formatting/filesWithCRLFEndings/fileWithCRLFEnding.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | /* Error checking macros for the clock selction and clock enable defines */ 5 | 6 | #if ( (CLK_SOURCE != CLK_SOURCE_LOCO) && \ 7 | (CLK_SOURCE != CLK_SOURCE_HOCO) && \ 8 | (CLK_SOURCE != CLK_SOURCE_MAIN) && \ 9 | (CLK_SOURCE != CLK_SOURCE_SUB) && \ 10 | (CLK_SOURCE != CLK_SOURCE_PLL) ) 11 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 12 | #endif 13 | 14 | 15 | #if (CLK_SOURCE == CLK_SOURCE_HOCO) && (ENABLE_HOCO == 0) 16 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 17 | #endif 18 | 19 | #if (CLK_SOURCE == CLK_SOURCE_MAIN) && (ENABLE_MAIN == 0) 20 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 21 | #endif 22 | 23 | #if (CLK_SOURCE == CLK_SOURCE_SUB) && (ENABLE_SUB == 0) 24 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if (CLK_SOURCE == CLK_SOURCE_PLL) && (ENABLE_PLL == 0) 28 | #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" 29 | #endif 30 | 31 | #if ( FCLK_FREQUENCY > 50000000L ) 32 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 33 | #endif 34 | 35 | #if ( ICLK_FREQUENCY > 100000000L ) 36 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 37 | #endif 38 | 39 | #if ( BCLK_FREQUENCY > 100000000L ) 40 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 41 | #endif 42 | 43 | #if ( PCLKB_FREQUENCY > 50000000L ) 44 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /clang-formatting/filesWithCRLFEndings/fileWithCRLFEndingWithDifferentExtension.txt: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | /* Error checking macros for the clock selction and clock enable defines */ 5 | 6 | #if ( (CLK_SOURCE != CLK_SOURCE_LOCO) && \ 7 | (CLK_SOURCE != CLK_SOURCE_HOCO) && \ 8 | (CLK_SOURCE != CLK_SOURCE_MAIN) && \ 9 | (CLK_SOURCE != CLK_SOURCE_SUB) && \ 10 | (CLK_SOURCE != CLK_SOURCE_PLL) ) 11 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 12 | #endif 13 | 14 | 15 | #if (CLK_SOURCE == CLK_SOURCE_HOCO) && (ENABLE_HOCO == 0) 16 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 17 | #endif 18 | 19 | #if (CLK_SOURCE == CLK_SOURCE_MAIN) && (ENABLE_MAIN == 0) 20 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 21 | #endif 22 | 23 | #if (CLK_SOURCE == CLK_SOURCE_SUB) && (ENABLE_SUB == 0) 24 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if (CLK_SOURCE == CLK_SOURCE_PLL) && (ENABLE_PLL == 0) 28 | #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" 29 | #endif 30 | 31 | #if ( FCLK_FREQUENCY > 50000000L ) 32 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 33 | #endif 34 | 35 | #if ( ICLK_FREQUENCY > 100000000L ) 36 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 37 | #endif 38 | 39 | #if ( BCLK_FREQUENCY > 100000000L ) 40 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 41 | #endif 42 | 43 | #if ( PCLKB_FREQUENCY > 50000000L ) 44 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 45 | #endif 46 | -------------------------------------------------------------------------------- /formatting/goodFiles/include/fileWithErrorInclude/goodHeader.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | /* Error checking macros for the clock selction and clock enable defines */ 5 | 6 | #if ( ( CLK_SOURCE != CLK_SOURCE_LOCO ) && ( CLK_SOURCE != CLK_SOURCE_HOCO ) && \ 7 | ( CLK_SOURCE != CLK_SOURCE_MAIN ) && ( CLK_SOURCE != CLK_SOURCE_SUB ) && \ 8 | ( CLK_SOURCE != CLK_SOURCE_PLL ) ) 9 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 10 | #endif 11 | 12 | #if ( CLK_SOURCE == CLK_SOURCE_HOCO ) && ( ENABLE_HOCO == 0 ) 13 | #error \ 14 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 15 | #endif 16 | 17 | #if ( CLK_SOURCE == CLK_SOURCE_MAIN ) && ( ENABLE_MAIN == 0 ) 18 | #error \ 19 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 20 | #endif 21 | 22 | #if ( CLK_SOURCE == CLK_SOURCE_SUB ) && ( ENABLE_SUB == 0 ) 23 | #error \ 24 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if ( CLK_SOURCE == CLK_SOURCE_PLL ) && ( ENABLE_PLL == 0 ) 28 | #error \ 29 | "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" 30 | #endif 31 | 32 | #if ( FCLK_FREQUENCY > 50000000L ) 33 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 34 | #endif 35 | 36 | #if ( ICLK_FREQUENCY > 100000000L ) 37 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 38 | #endif 39 | 40 | #if ( BCLK_FREQUENCY > 100000000L ) 41 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 42 | #endif 43 | 44 | #if ( PCLKB_FREQUENCY > 50000000L ) 45 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 46 | #endif 47 | 48 | #endif /* ifndef CGC_ERROR_H_ */ 49 | -------------------------------------------------------------------------------- /formatting/goodFiles/include/fileWithErrorInclude/goodHeaderTwo.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | /* Error checking macros for the clock selction and clock enable defines */ 5 | 6 | #if ( ( CLK_SOURCE != CLK_SOURCE_LOCO ) && ( CLK_SOURCE != CLK_SOURCE_HOCO ) && \ 7 | ( CLK_SOURCE != CLK_SOURCE_MAIN ) && ( CLK_SOURCE != CLK_SOURCE_SUB ) && \ 8 | ( CLK_SOURCE != CLK_SOURCE_PLL ) ) 9 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 10 | #endif 11 | 12 | #if ( CLK_SOURCE == CLK_SOURCE_HOCO ) && ( ENABLE_HOCO == 0 ) 13 | #error \ 14 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 15 | #endif 16 | 17 | #if ( CLK_SOURCE == CLK_SOURCE_MAIN ) && ( ENABLE_MAIN == 0 ) 18 | #error \ 19 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 20 | #endif 21 | 22 | #if ( CLK_SOURCE == CLK_SOURCE_SUB ) && ( ENABLE_SUB == 0 ) 23 | #error \ 24 | "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if ( CLK_SOURCE == CLK_SOURCE_PLL ) && ( ENABLE_PLL == 0 ) 28 | #error \ 29 | "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" 30 | #endif 31 | 32 | #if ( FCLK_FREQUENCY > 50000000L ) 33 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 34 | #endif 35 | 36 | #if ( ICLK_FREQUENCY > 100000000L ) 37 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 38 | #endif 39 | 40 | #if ( BCLK_FREQUENCY > 100000000L ) 41 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 42 | #endif 43 | 44 | #if ( PCLKB_FREQUENCY > 50000000L ) 45 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 46 | #endif 47 | 48 | #endif /* ifndef CGC_ERROR_H_ */ 49 | -------------------------------------------------------------------------------- /formatting/filesWithCRLFEndings/fileWithCRLFEndingWithDifferentExtension.txt: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | /* Error checking macros for the clock selction and clock enable defines */ 5 | 6 | #if ( (CLK_SOURCE != CLK_SOURCE_LOCO) && \ 7 | (CLK_SOURCE != CLK_SOURCE_HOCO) && \ 8 | (CLK_SOURCE != CLK_SOURCE_MAIN) && \ 9 | (CLK_SOURCE != CLK_SOURCE_SUB) && \ 10 | (CLK_SOURCE != CLK_SOURCE_PLL) ) 11 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 12 | #endif 13 | 14 | 15 | #if (CLK_SOURCE == CLK_SOURCE_HOCO) && (ENABLE_HOCO == 0) 16 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 17 | #endif 18 | 19 | #if (CLK_SOURCE == CLK_SOURCE_MAIN) && (ENABLE_MAIN == 0) 20 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 21 | #endif 22 | 23 | #if (CLK_SOURCE == CLK_SOURCE_SUB) && (ENABLE_SUB == 0) 24 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if (CLK_SOURCE == CLK_SOURCE_PLL) && (ENABLE_PLL == 0) 28 | #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h" 29 | #endif 30 | 31 | #if ( FCLK_FREQUENCY > 50000000L ) 32 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 33 | #endif 34 | 35 | #if ( ICLK_FREQUENCY > 100000000L ) 36 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 37 | #endif 38 | 39 | #if ( BCLK_FREQUENCY > 100000000L ) 40 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 41 | #endif 42 | 43 | #if ( PCLKB_FREQUENCY > 50000000L ) 44 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 45 | #endif 46 | 47 | #endif -------------------------------------------------------------------------------- /formatting/goodFiles/include/formatErrorTest.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | 5 | 6 | 7 | 8 | #include 9 | #include 10 | 11 | /* Error checking macros for the clock selction and clock enable defines */ 12 | 13 | #if( ( CLK_SOURCE != CLK_SOURCE_LOCO ) && ( CLK_SOURCE != CLK_SOURCE_HOCO ) && \ 14 | ( CLK_SOURCE != CLK_SOURCE_MAIN ) && ( CLK_SOURCE != CLK_SOURCE_SUB ) && \ 15 | ( CLK_SOURCE != CLK_SOURCE_PLL ) ) 16 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 17 | #endif 18 | 19 | #if( CLK_SOURCE == CLK_SOURCE_HOCO ) && ( ENABLE_HOCO == 0 ) 20 | #error "HOCO has been specified as the CLK_SOURCE but dsafa ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 21 | #endif 22 | 23 | #if( CLK_SOURCE == CLK_SOURCE_MAIN ) && ( ENABLE_MAIN == 0 ) 24 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if( CLK_SOURCE == CLK_SOURCE_SUB ) && ( ENABLE_SUB == 0 ) 28 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 29 | #endif 30 | 31 | #if( CLK_SOURCE == CLK_SOURCE_PLL ) && ( ENABLE_PLL == 0 ) 32 | #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h and I am supppppppppppppppperrrrrrrrr long" 33 | #endif 34 | 35 | #if( FCLK_FREQUENCY > 50000000L ) 36 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 37 | #endif 38 | 39 | #if( ICLK_FREQUENCY > 100000000L ) 40 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 41 | #endif 42 | #if( BCLK_FREQUENCY > 100000000L ) 43 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 44 | #endif 45 | #if( PCLKB_FREQUENCY > 50000000L ) 46 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 47 | #endif 48 | 49 | #endif -------------------------------------------------------------------------------- /clang-formatting/goodFiles/include/formatErrorTest.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | 5 | 6 | 7 | 8 | #include 9 | #include 10 | 11 | /* Error checking macros for the clock selction and clock enable defines */ 12 | 13 | #if( ( CLK_SOURCE != CLK_SOURCE_LOCO ) && ( CLK_SOURCE != CLK_SOURCE_HOCO ) && \ 14 | ( CLK_SOURCE != CLK_SOURCE_MAIN ) && ( CLK_SOURCE != CLK_SOURCE_SUB ) && \ 15 | ( CLK_SOURCE != CLK_SOURCE_PLL ) ) 16 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 17 | #endif 18 | 19 | #if( CLK_SOURCE == CLK_SOURCE_HOCO ) && ( ENABLE_HOCO == 0 ) 20 | #error "HOCO has been specified as the CLK_SOURCE but dsafa ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 21 | #endif 22 | 23 | #if( CLK_SOURCE == CLK_SOURCE_MAIN ) && ( ENABLE_MAIN == 0 ) 24 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if( CLK_SOURCE == CLK_SOURCE_SUB ) && ( ENABLE_SUB == 0 ) 28 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 29 | #endif 30 | 31 | #if( CLK_SOURCE == CLK_SOURCE_PLL ) && ( ENABLE_PLL == 0 ) 32 | #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h and I am supppppppppppppppperrrrrrrrr long" 33 | #endif 34 | 35 | #if( FCLK_FREQUENCY > 50000000L ) 36 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 37 | #endif 38 | 39 | #if( ICLK_FREQUENCY > 100000000L ) 40 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 41 | #endif 42 | #if( BCLK_FREQUENCY > 100000000L ) 43 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 44 | #endif 45 | #if( PCLKB_FREQUENCY > 50000000L ) 46 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 47 | #endif 48 | 49 | #endif -------------------------------------------------------------------------------- /formatting/goodFiles/include/fileWithErrorInclude/errorFileInDirectory.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | 5 | 6 | 7 | 8 | #include 9 | #include 10 | 11 | /* Error checking macros for the clock selction and clock enable defines */ 12 | 13 | #if( ( CLK_SOURCE != CLK_SOURCE_LOCO ) && ( CLK_SOURCE != CLK_SOURCE_HOCO ) && \ 14 | ( CLK_SOURCE != CLK_SOURCE_MAIN ) && ( CLK_SOURCE != CLK_SOURCE_SUB ) && \ 15 | ( CLK_SOURCE != CLK_SOURCE_PLL ) ) 16 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 17 | #endif 18 | 19 | #if( CLK_SOURCE == CLK_SOURCE_HOCO ) && ( ENABLE_HOCO == 0 ) 20 | #error "HOCO has been specified as the CLK_SOURCE but dsafa ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 21 | #endif 22 | 23 | #if( CLK_SOURCE == CLK_SOURCE_MAIN ) && ( ENABLE_MAIN == 0 ) 24 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if( CLK_SOURCE == CLK_SOURCE_SUB ) && ( ENABLE_SUB == 0 ) 28 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 29 | #endif 30 | 31 | #if( CLK_SOURCE == CLK_SOURCE_PLL ) && ( ENABLE_PLL == 0 ) 32 | #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h and I am supppppppppppppppperrrrrrrrr long" 33 | #endif 34 | 35 | #if( FCLK_FREQUENCY > 50000000L ) 36 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 37 | #endif 38 | 39 | #if( ICLK_FREQUENCY > 100000000L ) 40 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 41 | #endif 42 | #if( BCLK_FREQUENCY > 100000000L ) 43 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 44 | #endif 45 | #if( PCLKB_FREQUENCY > 50000000L ) 46 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 47 | #endif 48 | 49 | #endif -------------------------------------------------------------------------------- /clang-formatting/goodFiles/include/fileWithErrorInclude/errorFileInDirectory.h: -------------------------------------------------------------------------------- 1 | #ifndef CGC_ERROR_H_ 2 | #define CGC_ERROR_H_ 3 | 4 | 5 | 6 | 7 | 8 | #include 9 | #include 10 | 11 | /* Error checking macros for the clock selction and clock enable defines */ 12 | 13 | #if( ( CLK_SOURCE != CLK_SOURCE_LOCO ) && ( CLK_SOURCE != CLK_SOURCE_HOCO ) && \ 14 | ( CLK_SOURCE != CLK_SOURCE_MAIN ) && ( CLK_SOURCE != CLK_SOURCE_SUB ) && \ 15 | ( CLK_SOURCE != CLK_SOURCE_PLL ) ) 16 | #error "No CLK_SOURCE specified. Please specify a valid CLK_SOURCE"; 17 | #endif 18 | 19 | #if( CLK_SOURCE == CLK_SOURCE_HOCO ) && ( ENABLE_HOCO == 0 ) 20 | #error "HOCO has been specified as the CLK_SOURCE but dsafa ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 21 | #endif 22 | 23 | #if( CLK_SOURCE == CLK_SOURCE_MAIN ) && ( ENABLE_MAIN == 0 ) 24 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 25 | #endif 26 | 27 | #if( CLK_SOURCE == CLK_SOURCE_SUB ) && ( ENABLE_SUB == 0 ) 28 | #error "HOCO has been specified as the CLK_SOURCE but ENABLE_HOCO is (0). Please set to (1) in file cgc.h" 29 | #endif 30 | 31 | #if( CLK_SOURCE == CLK_SOURCE_PLL ) && ( ENABLE_PLL == 0 ) 32 | #error "PLL has been specified as the CLK_SOURCE but ENABLE_PLL is (0). Please set to (1) in file cgc.h and I am supppppppppppppppperrrrrrrrr long" 33 | #endif 34 | 35 | #if( FCLK_FREQUENCY > 50000000L ) 36 | #error "FCLK_FREQUENCY Error: Please enter a valid divider value" 37 | #endif 38 | 39 | #if( ICLK_FREQUENCY > 100000000L ) 40 | #error "ICLK_FREQUENCY Error: Please enter a valid divider value" 41 | #endif 42 | #if( BCLK_FREQUENCY > 100000000L ) 43 | #error "BCLK_FREQUENCY Error: Please enter a valid divider value" 44 | #endif 45 | #if( PCLKB_FREQUENCY > 50000000L ) 46 | #error "PCLKB_FREQUENCY Error: Please enter a valid divider value" 47 | #endif 48 | 49 | #endif -------------------------------------------------------------------------------- /complexity/action.yml: -------------------------------------------------------------------------------- 1 | name: 'complexity' 2 | description: 'CI complexity check' 3 | inputs: 4 | path: 5 | description: 'Path to repository folder to run complexity check in.' 6 | required: false 7 | default: ./ 8 | source_path: 9 | description: 'Path to the folder in the repository containing the source code.' 10 | required: false 11 | default: source 12 | horrid_threshold: 13 | description: 'The horrid threshold parameter passed to the invocation of complexity' 14 | required: false 15 | default: 10 16 | 17 | runs: 18 | using: "composite" 19 | steps: 20 | - env: 21 | stepName: Install Dependencies 22 | bashPass: \033[32;1mPASSED - 23 | bashInfo: \033[33;1mINFO - 24 | bashFail: \033[31;1mFAILED - 25 | bashEnd: \033[0 26 | name: ${{ env.stepName }} 27 | shell: bash 28 | run: | 29 | # ${{ env.stepName }} 30 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 31 | sudo apt-get install complexity -y 32 | echo -e "::endgroup::" 33 | echo -e "${{ env.bashPass }} ${{env.stepName }} ${{ env.bashEnd }}" 34 | 35 | - env: 36 | stepName: Complexity 37 | bashPass: \033[32;1mPASSED - 38 | bashInfo: \033[33;1mINFO - 39 | bashFail: \033[31;1mFAILED - 40 | bashEnd: \033[0m 41 | name: ${{ env.stepName }} 42 | working-directory: ${{ inputs.path }} 43 | shell: bash 44 | run: | 45 | # ${{ env.stepName }} 46 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 47 | echo -e "${{ env.bashInfo }} Have complexity limit of ${{ inputs.horrid_threshold }} ${{ env.bashEnd }}" 48 | exitStatus=0 49 | 50 | # Use find to find all files ending with a .c inside of the input directory 51 | # From there run the complexity check against them 52 | find ${{ inputs.source_path }}/ -iname '*.c' |\ 53 | xargs complexity --scores --threshold=0 --horrid-threshold=${{ inputs.horrid_threshold }} 54 | 55 | echo -e "::endgroup::" 56 | echo -e "${{ env.bashPass }} ${{env.stepName }} ${{ env.bashEnd }}" 57 | exit 0 58 | -------------------------------------------------------------------------------- /executable-monitor/README.md: -------------------------------------------------------------------------------- 1 | # Executable Monitor Summary: 2 | This is a python program designed to run an executable and monitor it. 3 | It can either look for a string being printed to the program's standard out, or check for an exit condition. 4 | It supports retry logic, as well as deadlocking programs. 5 | The tests for the executable monitor mostly live inside of the CI-CD-Github-Actions/.github/workflows/test.yml file. 6 | A few tests have been added below for ease of copying and pasting it though. 7 | These tests are meant to be run using the test.c file that lives inside of this directory. 8 | test.c prints out the system time and then sleeps for a set duration 9 | # Provided Test.c: 10 | test.c is a simple C program that prints the current minutes, hours, and seconds. 11 | As well as how long the program is going to sleep for. 12 | These values can then be used as a test for the executable-monitor. 13 | ```gcc test.c -o test.out``` 14 | 15 | Test.c can also be set to exit with the current time in minutes by using the command. 16 | By setting the exit code or success line to be a time in the future a test can be written that requires retry logic. 17 | By setting the success-line to be a time in the future the program will need to "retry" until this time occurs 18 | By setting the exit code of the program to be the current minute, the program will need to "retry" until this exit code is seen. 19 | ```gcc test.c -DEXIT_WITH_MINUTES -o test.out``` 20 | 21 | 22 | # How to call the program locally with some basic tests. 23 | Success Test | Test the case where the success line is found but the exe does not exit, ensure exit status is 0 24 | ```python3 executable-monitor.py --success-line "SLEEPING FOR 6 SECONDS" --retry-attempts 2 --timeout-seconds 10 --exe-path test.out; echo $?``` 25 | 26 | Success Test | Test the case where the success line is not found, but the exe exits, ensure exit status is 0 27 | ```python3 executable-monitor.py --success-line "THIS WILL NEVER PRINT" --success-exit-code 0 --retry-attempts 2 --timeout-seconds 60 --exe-path test.out; echo $?``` 28 | 29 | Failure Test | Test the case where exit status code and success line are given but hit timeout, ensure exit status is 1 30 | ```python3 executable-monitor.py --success-exit-code 0 --success-line "SLEEPING FOR 12 SECONDS" --retry-attempts 2 --timeout-seconds 10 --exe-path test.out ; echo $?``` 31 | -------------------------------------------------------------------------------- /localhost-mqtt-broker/localhost_mqtt_broker.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import asyncio 3 | import os 4 | import socket 5 | from argparse import ArgumentParser 6 | from amqtt.broker import Broker 7 | 8 | logger = logging.getLogger(__name__) 9 | 10 | LOCAL_HOST_IP = socket.gethostbyname("localhost") 11 | 12 | # Parse passed in credentials 13 | parser = ArgumentParser(description='Localhost MQTT broker.') 14 | 15 | parser.add_argument('--host', 16 | type=str, 17 | required=True, 18 | help='Host address for the echo server.') 19 | parser.add_argument('--root-ca-cert-path', 20 | type=str, 21 | required=True, 22 | help='Path to the root CA certificate.') 23 | parser.add_argument('--server-cert-path', 24 | type=str, 25 | required=True, 26 | help='Path to the server certificate.') 27 | parser.add_argument('--server-priv-key-path', 28 | type=str, 29 | required=True, 30 | help='Path to the private key') 31 | args = parser.parse_args() 32 | 33 | # Broker configuration 34 | config = { 35 | "listeners": { 36 | "default": { 37 | "type": "tcp", 38 | "bind": f"{args.host}:1883", 39 | "max-connections": 1000, 40 | }, 41 | "tls": { 42 | "type": "tcp", 43 | "bind": f"{args.host}:8883", 44 | "max-connections": 1000, 45 | "ssl": "on", 46 | "cafile": args.root_ca_cert_path, 47 | "certfile": args.server_cert_path, 48 | "keyfile": args.server_priv_key_path, 49 | }, 50 | }, 51 | "sys_interval": 10, 52 | "auth": { 53 | "allow-anonymous": True, 54 | "password-file": os.path.join( 55 | os.path.dirname(os.path.realpath(__file__)), "passwd" 56 | ), 57 | "plugins": ["auth_anonymous"], 58 | }, 59 | "topic-check": { 60 | "enabled": True, 61 | "plugins": [] 62 | }, 63 | } 64 | 65 | broker = Broker(config) 66 | 67 | async def broker_coroutine(): 68 | await broker.start() 69 | 70 | if __name__ == "__main__": 71 | formatter = "[%(asctime)s] :: %(levelname)s :: %(name)s :: %(message)s" 72 | logging.basicConfig(level=logging.DEBUG, format=formatter) 73 | 74 | # Start the MQTT broker 75 | asyncio.get_event_loop().run_until_complete(broker_coroutine()) 76 | asyncio.get_event_loop().run_forever() 77 | -------------------------------------------------------------------------------- /doxygen/action.yml: -------------------------------------------------------------------------------- 1 | name: 'doxygen' 2 | description: 'CI doxygen build check' 3 | inputs: 4 | path: 5 | description: 'Path to repository folder to run doxygen generation in.' 6 | required: false 7 | default: ./ 8 | libs_parent_dir_path: 9 | description: 'Comma-separated list of parent directory path of libraries. Path should be relative to repository root.' 10 | required: false 11 | default: ./ 12 | doxygen_link: 13 | description: 'Download link for doxygen tar.gz (default version 1.9.6).' 14 | required: false 15 | default: "https://sourceforge.net/projects/doxygen/files/rel-1.9.6/doxygen-1.9.6.linux.bin.tar.gz" 16 | doxygen_dependencies: 17 | description: 'Space-separated dependencies for doxygen.' 18 | required: false 19 | default: libclang-18-dev libclang-cpp18 graphviz 20 | generate_zip: 21 | description: 'Flag to indicate whether a ZIP output should be created.' 22 | required: false 23 | default: 'false' 24 | 25 | runs: 26 | using: "composite" 27 | steps: 28 | - env: 29 | bashPass: \033[32;1mPASSED - 30 | bashInfo: \033[33;1mINFO - 31 | bashFail: \033[31;1mFAILED - 32 | bashEnd: \033[0m 33 | stepName: Install Doxygen 34 | name: ${{ env.stepName }} 35 | shell: bash 36 | run: | 37 | # ${{ env.stepName }} 38 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 39 | wget -qO- "${{ inputs.doxygen_link }}" | sudo tar --strip-components=1 -xz -C /usr/local 40 | sudo apt-get install -y ${{ inputs.doxygen_dependencies }} 41 | echo -e "::endgroup::" 42 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 43 | 44 | - env: 45 | bashPass: \033[32;1mPASSED - 46 | bashInfo: \033[33;1mINFO - 47 | bashFail: \033[31;1mFAILED - 48 | bashEnd: \033[0m 49 | stepName: Verify Doxygen build and Generate ZIP (if specified) 50 | name: ${{ env.stepName }} 51 | working-directory: ${{ inputs.path }} 52 | shell: bash 53 | run: | 54 | # ${{ env.stepName }} 55 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 56 | if [[ ${{ inputs.generate_zip }} == "true" ]]; then 57 | python3 $GITHUB_ACTION_PATH/generate_doxygen.py --root ./ --library-directories ${{ inputs.libs_parent_dir_path }} --zip 58 | else 59 | doxygen docs/doxygen/config.doxyfile 2>&1 | tee doxyoutput.txt 60 | if [[ "$(wc -c < doxyoutput.txt | bc)" = "0" ]]; then exit 0; else exit 1; fi 61 | fi 62 | echo -e "::endgroup::" 63 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 64 | -------------------------------------------------------------------------------- /ssl-credential-creator/action.yml: -------------------------------------------------------------------------------- 1 | name: 'SSL Credential Creator' 2 | description: 'Creates a Root CA private key, a Root CA certificate, a server private key, a server certificate, a device private key, and certificate. These can be used to set up servers with authentication.' 3 | 4 | outputs: 5 | root-ca-priv-key-path: 6 | description: "Root CA private key file path." 7 | value: ${{ steps.generate-credentials.outputs.root-ca-priv-key-path }} 8 | root-ca-cert-path: 9 | description: "Root CA certificate file path." 10 | value: ${{ steps.generate-credentials.outputs.root-ca-cert-path }} 11 | server-priv-key-path: 12 | description: "Server private key file path." 13 | value: ${{ steps.generate-credentials.outputs.server-priv-key-path }} 14 | server-cert-path: 15 | description: "Server certificate file path." 16 | value: ${{ steps.generate-credentials.outputs.server-cert-path }} 17 | device-priv-key-path: 18 | description: "Device private key file path." 19 | value: ${{ steps.generate-credentials.outputs.device-priv-key-path }} 20 | device-cert-path: 21 | description: "Device certificate file path." 22 | value: ${{ steps.generate-credentials.outputs.device-cert-path }} 23 | 24 | runs: 25 | using: "composite" 26 | steps: 27 | - env: 28 | bashPass: \033[32;1mPASSED - 29 | bashInfo: \033[33;1mINFO - 30 | bashFail: \033[31;1mFAILED - 31 | bashEnd: \033[0m 32 | stepName: Install Dependencies 33 | shell: bash 34 | run: | 35 | # ${{ env.stepName }} 36 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 37 | pip install -r $GITHUB_ACTION_PATH/requirements.txt 38 | echo -e "::endgroup::" 39 | echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}" 40 | 41 | - env: 42 | bashPass: \033[32;1mPASSED - 43 | bashInfo: \033[33;1mINFO - 44 | bashFail: \033[31;1mFAILED - 45 | bashEnd: \033[0m 46 | stepName: Generate credentials 47 | id: generate-credentials 48 | shell: bash 49 | run: | 50 | # ${{ env.stepName }} 51 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 52 | python3 $GITHUB_ACTION_PATH/ssl_credential_creator.py 53 | echo "root-ca-priv-key-path=$(pwd)/root_ca_priv_key.key" >> $GITHUB_OUTPUT 54 | echo "root-ca-cert-path=$(pwd)/root_ca_cert.crt" >> $GITHUB_OUTPUT 55 | echo "server-priv-key-path=$(pwd)/server_priv_key.key" >> $GITHUB_OUTPUT 56 | echo "server-cert-path=$(pwd)/server_cert.crt" >> $GITHUB_OUTPUT 57 | echo "device-priv-key-path=$(pwd)/device_priv_key.key" >> $GITHUB_OUTPUT 58 | echo "device-cert-path=$(pwd)/device_cert.crt" >> $GITHUB_OUTPUT 59 | echo -e "::endgroup::" 60 | echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}" 61 | 62 | -------------------------------------------------------------------------------- /clang-formatting/goodFiles/include/goodHeaderTwo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.1 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | * 25 | * https://www.FreeRTOS.org 26 | * https://github.com/FreeRTOS 27 | * 28 | */ 29 | 30 | #ifndef INC_FREERTOS_H 31 | #define INC_FREERTOS_H 32 | 33 | /* 34 | * Include the generic headers required for the FreeRTOS port being used. 35 | */ 36 | #include 37 | 38 | /* 39 | * If stdint.h cannot be located then: 40 | * + If using GCC ensure the -nostdint options is *not* being used. 41 | * + Ensure the project's include path includes the directory in which your 42 | * compiler stores stdint.h. 43 | * + Set any compiler options necessary for it to support C99, as technically 44 | * stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any 45 | * other way). 46 | * + The FreeRTOS download includes a simple stdint.h definition that can be 47 | * used in cases where none is provided by the compiler. The files only 48 | * contains the typedefs required to build FreeRTOS. Read the instructions 49 | * in FreeRTOS/source/stdint.readme for more information. 50 | */ 51 | #include /* READ COMMENT ABOVE. */ 52 | 53 | /* *INDENT-OFF* */ 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | /* *INDENT-ON* */ 58 | 59 | /* Application specific configuration options. */ 60 | #include "FreeRTOSConfig.h" 61 | 62 | /* Basic FreeRTOS definitions. */ 63 | #include "projdefs.h" 64 | 65 | /* Definitions specific to the port being used. */ 66 | #include "hal_stdtypes.h" 67 | #include "portable.h" 68 | /* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */ 69 | #ifndef configUSE_NEWLIB_REENTRANT 70 | #define configUSE_NEWLIB_REENTRANT 0 71 | #endif 72 | 73 | #endif -------------------------------------------------------------------------------- /formatting/goodFiles/include/goodHeaderTwo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.5.1 3 | * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * SPDX-License-Identifier: MIT 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | * SOFTWARE. 24 | * 25 | * https://www.FreeRTOS.org 26 | * https://github.com/FreeRTOS 27 | * 28 | */ 29 | 30 | #ifndef INC_FREERTOS_H 31 | #define INC_FREERTOS_H 32 | 33 | /* 34 | * Include the generic headers required for the FreeRTOS port being used. 35 | */ 36 | #include 37 | 38 | /* 39 | * If stdint.h cannot be located then: 40 | * + If using GCC ensure the -nostdint options is *not* being used. 41 | * + Ensure the project's include path includes the directory in which your 42 | * compiler stores stdint.h. 43 | * + Set any compiler options necessary for it to support C99, as technically 44 | * stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any 45 | * other way). 46 | * + The FreeRTOS download includes a simple stdint.h definition that can be 47 | * used in cases where none is provided by the compiler. The files only 48 | * contains the typedefs required to build FreeRTOS. Read the instructions 49 | * in FreeRTOS/source/stdint.readme for more information. 50 | */ 51 | #include /* READ COMMENT ABOVE. */ 52 | 53 | /* *INDENT-OFF* */ 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | /* *INDENT-ON* */ 58 | 59 | /* Application specific configuration options. */ 60 | #include "FreeRTOSConfig.h" 61 | 62 | /* Basic FreeRTOS definitions. */ 63 | #include "projdefs.h" 64 | 65 | /* Definitions specific to the port being used. */ 66 | #include "hal_stdtypes.h" 67 | #include "portable.h" 68 | /* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */ 69 | #ifndef configUSE_NEWLIB_REENTRANT 70 | #define configUSE_NEWLIB_REENTRANT 0 71 | #endif 72 | 73 | #endif /* ifndef INC_FREERTOS_H */ 74 | -------------------------------------------------------------------------------- /manifest-verifier/action.yml: -------------------------------------------------------------------------------- 1 | name: 'verify-manifest' 2 | description: 'Verifies manifest.yml against missing submodule entires and stale version information' 3 | inputs: 4 | path: 5 | description: 'Path to repository folder containing manifest.yml to verify.' 6 | required: false 7 | default: ./ 8 | exclude-submodules: 9 | description: 'List of comma-separated relative path to submodules that should not be present in manifest.yml. Eg libraries/thirdparty/tinycbor,libraries/thirdparty/mbedtls' 10 | required: false 11 | default: '' 12 | fail-on-incorrect-version: 13 | description: 'Boolean flag to indicate if verification should fail if any submodule version in manifest.yml file is incorrect or stale.' 14 | required: false 15 | default: 'false' 16 | runs: 17 | using: "composite" 18 | steps: 19 | - env: 20 | bashPass: \033[32;1mPASSED - 21 | bashInfo: \033[33;1mINFO - 22 | bashFail: \033[31;1mFAILED - 23 | bashEnd: \033[0m 24 | stepName: Install Manifest Verification Dependencies 25 | name: ${{ env.stepName }} 26 | shell: bash 27 | run: | 28 | # ${{ env.stepName }} 29 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 30 | pip install -r $GITHUB_ACTION_PATH/requirements.txt 31 | exitStatus=$? 32 | echo -e "::endgroup::" 33 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 34 | 35 | - env: 36 | bashPass: \033[32;1mPASSED - 37 | bashInfo: \033[33;1mINFO - 38 | bashFail: \033[31;1mFAILED - 39 | bashEnd: \033[0m 40 | stepName: Run Manifest Verification Script 41 | name: ${{ env.stepName }} 42 | working-directory: ${{ inputs.path }} 43 | shell: bash 44 | run: | 45 | # ${{ env.stepName }} 46 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 47 | 48 | if [[ "${{ inputs.fail-on-incorrect-version }}" == "true" ]]; then 49 | echo -e "${{ env.bashInfo}} This action will cause a PR Failure if a submodule is not equal to the manifest.yml version ${{ inputs.fail-on-incorrect-version }} ${{ env.bashEnd }}" 50 | echo -e "${{ env.bashInfo}} Running: python3 manifest-verifier.py --ignore-submodule-path=${{ inputs.exclude-submodules }} --fail-on-incorrect-version ${{ inputs.fail-on-incorrect-version }} ${{ env.bashEnd }}" 51 | python3 $GITHUB_ACTION_PATH/manifest-verifier.py --ignore-submodule-path=${{ inputs.exclude-submodules }} --fail-on-incorrect-version 52 | else 53 | echo -e "${{ env.bashInfo}} Running: python3 manifest-verifier.py --ignore-submodule-path=${{ inputs.exclude-submodules }} ${{ env.bashEnd }}" 54 | python3 $GITHUB_ACTION_PATH/manifest-verifier.py --ignore-submodule-path=${{ inputs.exclude-submodules }} 55 | fi 56 | exitStatus=$? 57 | 58 | echo -e "::endgroup::" 59 | if [ "$exitStatus" = "0" ]; then 60 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 61 | else 62 | echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}" 63 | exit 1 64 | fi 65 | -------------------------------------------------------------------------------- /executable-monitor/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | typedef struct TimeStruct 8 | { 9 | uint64_t hour; 10 | uint64_t minutes; 11 | uint64_t seconds; 12 | uint64_t msec; 13 | } TimeStruct; 14 | 15 | 16 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 17 | #include 18 | /* Remove the warning about implicit sleep even with windows.h included */ 19 | extern void sleep( int miliseconds ); 20 | void getTime( struct TimeStruct * currentTime ) 21 | { 22 | SYSTEMTIME st, lt; 23 | 24 | GetLocalTime( < ); 25 | currentTime->hour = lt.wHour; 26 | currentTime->minutes = lt.wMinute; 27 | currentTime->seconds = lt.wSecond; 28 | currentTime->msec = lt.wMilliseconds; 29 | } 30 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct TimeStruct * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 46 | 47 | int main( int argc, 48 | char ** argv ) 49 | { 50 | TimeStruct currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application.\n" ); 58 | printf( "It prints the date and time and then sleeps for loopCount * 3\n" ); 59 | printf( "This program takes in two inputs, a loop count and an exit code\n" ); 60 | printf( "By default it will run %d loops and exit with exit status %d\n", totalLoops, exitCode ); 61 | } 62 | 63 | if( argc == 2 ) 64 | { 65 | totalLoops = atoi( argv[ 1 ] ); 66 | printf( "Will run for requested %d loops\n", totalLoops ); 67 | } 68 | 69 | if( argc == 3 ) 70 | { 71 | exitCode = atoi( argv[ 2 ] ); 72 | printf( "Will exit with supplied exit code %d\n", exitCode ); 73 | } 74 | 75 | setvbuf( stdout, NULL, _IONBF, 0 ); 76 | 77 | for( int i = 1U; i < totalLoops; i++ ) 78 | { 79 | getTime( ¤tTime ); 80 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d SECONDS\n", 81 | currentTime.hour, 82 | currentTime.minutes, 83 | currentTime.seconds, 84 | currentTime.msec, 85 | i * 3U ); 86 | sleep( i * 3U ); 87 | } 88 | 89 | #ifdef EXIT_WITH_MINUTES 90 | exitCode = currentTime.minutes; 91 | #endif 92 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 93 | return exitCode; 94 | } 95 | -------------------------------------------------------------------------------- /artifact-backup/action.yml: -------------------------------------------------------------------------------- 1 | name: 'artifact-backup' 2 | description: 'Backup release artifacts to S3' 3 | inputs: 4 | release_tag: 5 | description: 'Tag of the release' 6 | required: true 7 | artifact_path: 8 | description: 'Path to the generated artifact' 9 | required: true 10 | 11 | runs: 12 | using: "composite" 13 | steps: 14 | - name: Extract repository name 15 | id: repo-name 16 | shell: bash 17 | run: | 18 | REPO_NAME="${GITHUB_REPOSITORY#*/}" 19 | echo "name=$REPO_NAME" >> $GITHUB_OUTPUT 20 | echo "Repository: $GITHUB_REPOSITORY" 21 | echo "Repository Owner: $GITHUB_REPOSITORY_OWNER" 22 | echo "Repository Name: $REPO_NAME" 23 | 24 | - name: Get temporary AWS credentials 25 | uses: aws-actions/configure-aws-credentials@v4 26 | with: 27 | aws-region: us-east-1 28 | role-to-assume: arn:aws:iam::178185592318:role/GHRole-${{ github.repository_owner }}-${{ steps.repo-name.outputs.name }} 29 | role-duration-seconds: 900 30 | unset-current-credentials: true 31 | 32 | - name: Add file to s3 bucket 33 | env: 34 | BUCKET_NAME: frtos-artifact-bckup-us-east-1-alpha 35 | shell: bash 36 | run: | 37 | # Get the artifact file name and extension 38 | FILE=${{ inputs.artifact_path }} 39 | FILENAME=$(basename "$FILE") 40 | EXTENSION="${FILENAME##*.}" 41 | BASENAME="${FILENAME%.*}" 42 | 43 | # Rename with timestamp 44 | TIMESTAMP="$(date +%Y%m%d%H%M%S)" 45 | NEW_FILENAME="${BASENAME}.${TIMESTAMP}.${EXTENSION}" 46 | 47 | # Upload to S3 without overwriting 48 | if ! aws s3api put-object \ 49 | --bucket ${{ env.BUCKET_NAME }} \ 50 | --key ${{ github.repository }}/${{ inputs.release_tag }}/${NEW_FILENAME} \ 51 | --body ${{ inputs.artifact_path }} \ 52 | --if-none-match "*"; then 53 | echo "::error::Failed to upload artifact to S3" 54 | exit 1 55 | fi 56 | 57 | echo "Successfully uploaded artifact to S3" 58 | 59 | - name: Upload SHA256 of the artifact 60 | env: 61 | BUCKET_NAME: frtos-artifact-bckup-us-east-1-alpha 62 | shell: bash 63 | run: | 64 | # Calculate and upload SHA256 hash with platform compatibility 65 | if [[ "$OSTYPE" == "darwin"* ]]; then 66 | # macOS uses shasum 67 | HASH=$(shasum -a 256 "${{ inputs.artifact_path }}" | awk '{print $1}') 68 | else 69 | # Linux uses sha256sum 70 | HASH=$(sha256sum "${{ inputs.artifact_path }}" | awk '{print $1}') 71 | fi 72 | 73 | echo "$HASH" > SHA256.txt 74 | 75 | echo "Uploading SHA256.txt to S3..." 76 | if ! aws s3api put-object \ 77 | --bucket ${{ env.BUCKET_NAME }} \ 78 | --key ${{ github.repository }}/${{ inputs.release_tag }}/SHA256.txt \ 79 | --body SHA256.txt \ 80 | --if-none-match "*"; then 81 | echo "::error::Failed to upload SHA256 hash to S3" 82 | exit 1 83 | fi 84 | 85 | echo "Successfully uploaded SHA256 hash to S3" 86 | -------------------------------------------------------------------------------- /formatting/filesWithTrailingWhitespace/testWithTrailingWhitespace.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | typedef struct DateAndTime 8 | { 9 | uint64_t hour; 10 | uint64_t minutes; 11 | uint64_t seconds; 12 | uint64_t msec; 13 | } DateAndTime; 14 | 15 | 16 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 17 | #include 18 | /* Remove the warning about implicit sleep even with windows.h included */ 19 | extern void sleep( int miliseconds ); 20 | void getTime( struct DateAndTime * currentTime ) 21 | { 22 | SYSTEMTIME st, lt; 23 | 24 | GetLocalTime( < ); 25 | currentTime->hour = lt.wHour; 26 | currentTime->minutes = lt.wMinute; 27 | currentTime->seconds = lt.wSecond; 28 | currentTime->msec = lt.wMilliseconds; 29 | } 30 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 46 | 47 | int main( int argc, 48 | char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application.\n" ); 58 | printf( "It prints the date and time and then sleeps for loopCount * 3\n" ); 59 | printf( "This program takes in two inputs, a loop count and an exit code\n" ); 60 | printf( "By default it will run %d loops and exit with exit status %d\n", totalLoops, exitCode ); 61 | } 62 | 63 | if( argc == 2 ) 64 | { 65 | totalLoops = atoi( argv[ 1 ] ); 66 | printf( "Will run for requested %d loops\n", totalLoops ); 67 | } 68 | 69 | if( argc == 3 ) 70 | { 71 | exitCode = atoi( argv[ 2 ] ); 72 | printf( "Will exit with supplied exit code %d\n", exitCode ); 73 | } 74 | 75 | setvbuf( stdout, NULL, _IONBF, 0 ); 76 | 77 | for( int i = 1U; i < totalLoops; i++ ) 78 | { 79 | getTime( ¤tTime ); 80 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d SECONDS\n", 81 | currentTime.hour, 82 | currentTime.minutes, 83 | currentTime.seconds, 84 | currentTime.msec, 85 | i * 3U ); 86 | sleep( i * 3U ); 87 | } 88 | 89 | #ifdef EXIT_WITH_MINUTES 90 | exitCode = currentTime.minutes; 91 | #endif 92 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 93 | return exitCode; 94 | } 95 | -------------------------------------------------------------------------------- /clang-formatting/filesWithTrailingWhitespace/testWithTrailingWhitespace.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | typedef struct DateAndTime 8 | { 9 | uint64_t hour; 10 | uint64_t minutes; 11 | uint64_t seconds; 12 | uint64_t msec; 13 | } DateAndTime; 14 | 15 | 16 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 17 | #include 18 | /* Remove the warning about implicit sleep even with windows.h included */ 19 | extern void sleep( int miliseconds ); 20 | void getTime( struct DateAndTime * currentTime ) 21 | { 22 | SYSTEMTIME st, lt; 23 | 24 | GetLocalTime( < ); 25 | currentTime->hour = lt.wHour; 26 | currentTime->minutes = lt.wMinute; 27 | currentTime->seconds = lt.wSecond; 28 | currentTime->msec = lt.wMilliseconds; 29 | } 30 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 46 | 47 | int main( int argc, 48 | char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application.\n" ); 58 | printf( "It prints the date and time and then sleeps for loopCount * 3\n" ); 59 | printf( "This program takes in two inputs, a loop count and an exit code\n" ); 60 | printf( "By default it will run %d loops and exit with exit status %d\n", totalLoops, exitCode ); 61 | } 62 | 63 | if( argc == 2 ) 64 | { 65 | totalLoops = atoi( argv[ 1 ] ); 66 | printf( "Will run for requested %d loops\n", totalLoops ); 67 | } 68 | 69 | if( argc == 3 ) 70 | { 71 | exitCode = atoi( argv[ 2 ] ); 72 | printf( "Will exit with supplied exit code %d\n", exitCode ); 73 | } 74 | 75 | setvbuf( stdout, NULL, _IONBF, 0 ); 76 | 77 | for( int i = 1U; i < totalLoops; i++ ) 78 | { 79 | getTime( ¤tTime ); 80 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d SECONDS\n", 81 | currentTime.hour, 82 | currentTime.minutes, 83 | currentTime.seconds, 84 | currentTime.msec, 85 | i * 3U ); 86 | sleep( i * 3U ); 87 | } 88 | 89 | #ifdef EXIT_WITH_MINUTES 90 | exitCode = currentTime.minutes; 91 | #endif 92 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 93 | return exitCode; 94 | } 95 | -------------------------------------------------------------------------------- /formatting/filesWithFormattingErrors/testWithFormattingError.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | typedef struct DateAndTime 8 | { 9 | uint64_t hour; 10 | uint64_t minutes; 11 | uint64_t seconds; 12 | uint64_t msec; 13 | } DateAndTime; 14 | 15 | 16 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 17 | #include 18 | /* Remove the warning about implicit sleep even with windows.h included */ 19 | extern void sleep( int miliseconds ); 20 | void getTime( struct DateAndTime * currentTime ) 21 | { 22 | SYSTEMTIME st, lt; 23 | 24 | GetLocalTime( < ); 25 | currentTime->hour = lt.wHour; 26 | currentTime->minutes = lt.wMinute; 27 | currentTime->seconds = lt.wSecond; 28 | currentTime->msec = lt.wMilliseconds; 29 | } 30 | #else /* if defined( WIN32 ) || defined ( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 46 | 47 | int main( int argc, 48 | char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application .\n"); 58 | printf( "It prints the date and time and then sleeps for loopCount * 3\n" ); 59 | printf( "This program takes in two inputs, a loop count and an exit code\n" ); 60 | printf( "By default it will run %d loops and exit with exit status %d\n", totalLoops, exitCode ); 61 | } 62 | 63 | if( argc == 2 ) 64 | { 65 | totalLoops = atoi( argv[ 1 ] ); 66 | printf( "Will run for requested %d loops\n", totalLoops ); 67 | } 68 | 69 | if( argc == 3 ) 70 | { 71 | exitCode = atoi( argv[ 2 ] ); 72 | printf( "Will exit with supplied exit code %d\n", exitCode ); 73 | } 74 | 75 | setvbuf( stdout, NULL, _IONBF, 0 ); 76 | 77 | for(int i = 1U; i < totalLoops; i++ ) 78 | { 79 | getTime( ¤tTime ); 80 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d SECONDS\n", 81 | currentTime.hour, 82 | currentTime.minutes , 83 | currentTime.seconds, 84 | currentTime.msec, 85 | i * 3U ); 86 | sleep( i * 3U ); 87 | } 88 | 89 | #ifdef EXIT_WITH_MINUTES 90 | exitCode = currentTime.minutes; 91 | #endif 92 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n" 93 | , exitCode ); 94 | return exitCode; 95 | } 96 | -------------------------------------------------------------------------------- /formatting/goodFiles/source/README.md: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 30 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application.\n" ); 58 | printf( 59 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 60 | printf( "This program takes in two inputs, a loop count and an exit " 61 | "code\n" ); 62 | printf( "By default it will run %d loops and exit with exit status " 63 | "%d\n", 64 | totalLoops, 65 | exitCode ); 66 | } 67 | 68 | if( argc == 2 ) 69 | { 70 | totalLoops = atoi( argv[ 1 ] ); 71 | printf( "Will run for requested %d loops\n", totalLoops ); 72 | } 73 | 74 | if( argc == 3 ) 75 | { 76 | exitCode = atoi( argv[ 2 ] ); 77 | printf( "Will exit with supplied exit code %d\n", exitCode ); 78 | } 79 | 80 | setvbuf( stdout, NULL, _IONBF, 0 ); 81 | 82 | for( int i = 1U; i < totalLoops; i++ ) 83 | { 84 | getTime( ¤tTime ); 85 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 86 | "SECONDS\n", 87 | currentTime.hour, 88 | currentTime.minutes, 89 | currentTime.seconds, 90 | currentTime.msec, 91 | i * 3U ); 92 | sleep( i * 3U ); 93 | } 94 | 95 | #ifdef EXIT_WITH_MINUTES 96 | exitCode = currentTime.minutes; 97 | #endif 98 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 99 | return exitCode; 100 | } 101 | -------------------------------------------------------------------------------- /clang-formatting/goodFiles/source/README.md: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 30 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application.\n" ); 58 | printf( 59 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 60 | printf( "This program takes in two inputs, a loop count and an exit " 61 | "code\n" ); 62 | printf( "By default it will run %d loops and exit with exit status " 63 | "%d\n", 64 | totalLoops, 65 | exitCode ); 66 | } 67 | 68 | if( argc == 2 ) 69 | { 70 | totalLoops = atoi( argv[ 1 ] ); 71 | printf( "Will run for requested %d loops\n", totalLoops ); 72 | } 73 | 74 | if( argc == 3 ) 75 | { 76 | exitCode = atoi( argv[ 2 ] ); 77 | printf( "Will exit with supplied exit code %d\n", exitCode ); 78 | } 79 | 80 | setvbuf( stdout, NULL, _IONBF, 0 ); 81 | 82 | for( int i = 1U; i < totalLoops; i++ ) 83 | { 84 | getTime( ¤tTime ); 85 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 86 | "SECONDS\n", 87 | currentTime.hour, 88 | currentTime.minutes, 89 | currentTime.seconds, 90 | currentTime.msec, 91 | i * 3U ); 92 | sleep( i * 3U ); 93 | } 94 | 95 | #ifdef EXIT_WITH_MINUTES 96 | exitCode = currentTime.minutes; 97 | #endif 98 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 99 | return exitCode; 100 | } 101 | -------------------------------------------------------------------------------- /clang-formatting/goodFiles/source/goodSource.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 30 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application.\n" ); 58 | printf( 59 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 60 | printf( "This program takes in two inputs, a loop count and an exit " 61 | "code\n" ); 62 | printf( "By default it will run %d loops and exit with exit status " 63 | "%d\n", 64 | totalLoops, 65 | exitCode ); 66 | } 67 | 68 | if( argc == 2 ) 69 | { 70 | totalLoops = atoi( argv[ 1 ] ); 71 | printf( "Will run for requested %d loops\n", totalLoops ); 72 | } 73 | 74 | if( argc == 3 ) 75 | { 76 | exitCode = atoi( argv[ 2 ] ); 77 | printf( "Will exit with supplied exit code %d\n", exitCode ); 78 | } 79 | 80 | setvbuf( stdout, NULL, _IONBF, 0 ); 81 | 82 | for( int i = 1U; i < totalLoops; i++ ) 83 | { 84 | getTime( ¤tTime ); 85 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 86 | "SECONDS\n", 87 | currentTime.hour, 88 | currentTime.minutes, 89 | currentTime.seconds, 90 | currentTime.msec, 91 | i * 3U ); 92 | sleep( i * 3U ); 93 | } 94 | 95 | #ifdef EXIT_WITH_MINUTES 96 | exitCode = currentTime.minutes; 97 | #endif 98 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 99 | return exitCode; 100 | } 101 | -------------------------------------------------------------------------------- /clang-formatting/goodFiles/source/goodSourceTwo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 30 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application.\n" ); 58 | printf( 59 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 60 | printf( "This program takes in two inputs, a loop count and an exit " 61 | "code\n" ); 62 | printf( "By default it will run %d loops and exit with exit status " 63 | "%d\n", 64 | totalLoops, 65 | exitCode ); 66 | } 67 | 68 | if( argc == 2 ) 69 | { 70 | totalLoops = atoi( argv[ 1 ] ); 71 | printf( "Will run for requested %d loops\n", totalLoops ); 72 | } 73 | 74 | if( argc == 3 ) 75 | { 76 | exitCode = atoi( argv[ 2 ] ); 77 | printf( "Will exit with supplied exit code %d\n", exitCode ); 78 | } 79 | 80 | setvbuf( stdout, NULL, _IONBF, 0 ); 81 | 82 | for( int i = 1U; i < totalLoops; i++ ) 83 | { 84 | getTime( ¤tTime ); 85 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 86 | "SECONDS\n", 87 | currentTime.hour, 88 | currentTime.minutes, 89 | currentTime.seconds, 90 | currentTime.msec, 91 | i * 3U ); 92 | sleep( i * 3U ); 93 | } 94 | 95 | #ifdef EXIT_WITH_MINUTES 96 | exitCode = currentTime.minutes; 97 | #endif 98 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 99 | return exitCode; 100 | } 101 | -------------------------------------------------------------------------------- /clang-formatting/goodFiles/source/goodSourceThree.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 30 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application.\n" ); 58 | printf( 59 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 60 | printf( "This program takes in two inputs, a loop count and an exit " 61 | "code\n" ); 62 | printf( "By default it will run %d loops and exit with exit status " 63 | "%d\n", 64 | totalLoops, 65 | exitCode ); 66 | } 67 | 68 | if( argc == 2 ) 69 | { 70 | totalLoops = atoi( argv[ 1 ] ); 71 | printf( "Will run for requested %d loops\n", totalLoops ); 72 | } 73 | 74 | if( argc == 3 ) 75 | { 76 | exitCode = atoi( argv[ 2 ] ); 77 | printf( "Will exit with supplied exit code %d\n", exitCode ); 78 | } 79 | 80 | setvbuf( stdout, NULL, _IONBF, 0 ); 81 | 82 | for( int i = 1U; i < totalLoops; i++ ) 83 | { 84 | getTime( ¤tTime ); 85 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 86 | "SECONDS\n", 87 | currentTime.hour, 88 | currentTime.minutes, 89 | currentTime.seconds, 90 | currentTime.msec, 91 | i * 3U ); 92 | sleep( i * 3U ); 93 | } 94 | 95 | #ifdef EXIT_WITH_MINUTES 96 | exitCode = currentTime.minutes; 97 | #endif 98 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 99 | return exitCode; 100 | } 101 | -------------------------------------------------------------------------------- /clang-formatting/goodFiles/source/fileWithErrorSource/goodTest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 30 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application.\n" ); 58 | printf( 59 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 60 | printf( "This program takes in two inputs, a loop count and an exit " 61 | "code\n" ); 62 | printf( "By default it will run %d loops and exit with exit status " 63 | "%d\n", 64 | totalLoops, 65 | exitCode ); 66 | } 67 | 68 | if( argc == 2 ) 69 | { 70 | totalLoops = atoi( argv[ 1 ] ); 71 | printf( "Will run for requested %d loops\n", totalLoops ); 72 | } 73 | 74 | if( argc == 3 ) 75 | { 76 | exitCode = atoi( argv[ 2 ] ); 77 | printf( "Will exit with supplied exit code %d\n", exitCode ); 78 | } 79 | 80 | setvbuf( stdout, NULL, _IONBF, 0 ); 81 | 82 | for( int i = 1U; i < totalLoops; i++ ) 83 | { 84 | getTime( ¤tTime ); 85 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 86 | "SECONDS\n", 87 | currentTime.hour, 88 | currentTime.minutes, 89 | currentTime.seconds, 90 | currentTime.msec, 91 | i * 3U ); 92 | sleep( i * 3U ); 93 | } 94 | 95 | #ifdef EXIT_WITH_MINUTES 96 | exitCode = currentTime.minutes; 97 | #endif 98 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 99 | return exitCode; 100 | } 101 | -------------------------------------------------------------------------------- /formatting/filesWithFormattingErrors/goodFileInHere.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined ( _WIN32 ) || defined( __WIN32__ ) \ 30 | || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application .\n" ); 58 | printf( 59 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 60 | printf( "This program takes in two inputs, a loop count and an exit " 61 | "code\n" ); 62 | printf( "By default it will run %d loops and exit with exit status " 63 | "%d\n", 64 | totalLoops, 65 | exitCode ); 66 | } 67 | 68 | if( argc == 2 ) 69 | { 70 | totalLoops = atoi( argv[ 1 ] ); 71 | printf( "Will run for requested %d loops\n", totalLoops ); 72 | } 73 | 74 | if( argc == 3 ) 75 | { 76 | exitCode = atoi( argv[ 2 ] ); 77 | printf( "Will exit with supplied exit code %d\n", exitCode ); 78 | } 79 | 80 | setvbuf( stdout, NULL, _IONBF, 0 ); 81 | 82 | for( int i = 1U; i < totalLoops; i++ ) 83 | { 84 | getTime( ¤tTime ); 85 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 86 | "SECONDS\n", 87 | currentTime.hour, 88 | currentTime.minutes, 89 | currentTime.seconds, 90 | currentTime.msec, 91 | i * 3U ); 92 | sleep( i * 3U ); 93 | } 94 | 95 | #ifdef EXIT_WITH_MINUTES 96 | exitCode = currentTime.minutes; 97 | #endif 98 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 99 | return exitCode; 100 | } 101 | -------------------------------------------------------------------------------- /clang-formatting/filesWithFormattingErrors/goodFileInHere.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined ( _WIN32 ) || defined( __WIN32__ ) \ 30 | || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application .\n" ); 58 | printf( 59 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 60 | printf( "This program takes in two inputs, a loop count and an exit " 61 | "code\n" ); 62 | printf( "By default it will run %d loops and exit with exit status " 63 | "%d\n", 64 | totalLoops, 65 | exitCode ); 66 | } 67 | 68 | if( argc == 2 ) 69 | { 70 | totalLoops = atoi( argv[ 1 ] ); 71 | printf( "Will run for requested %d loops\n", totalLoops ); 72 | } 73 | 74 | if( argc == 3 ) 75 | { 76 | exitCode = atoi( argv[ 2 ] ); 77 | printf( "Will exit with supplied exit code %d\n", exitCode ); 78 | } 79 | 80 | setvbuf( stdout, NULL, _IONBF, 0 ); 81 | 82 | for( int i = 1U; i < totalLoops; i++ ) 83 | { 84 | getTime( ¤tTime ); 85 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 86 | "SECONDS\n", 87 | currentTime.hour, 88 | currentTime.minutes, 89 | currentTime.seconds, 90 | currentTime.msec, 91 | i * 3U ); 92 | sleep( i * 3U ); 93 | } 94 | 95 | #ifdef EXIT_WITH_MINUTES 96 | exitCode = currentTime.minutes; 97 | #endif 98 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 99 | return exitCode; 100 | } 101 | -------------------------------------------------------------------------------- /clang-formatting/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | AlignAfterOpenBracket: Align 4 | AlignConsecutiveAssignments: None 5 | AlignConsecutiveBitFields: AcrossEmptyLinesAndComments 6 | AlignConsecutiveDeclarations: None 7 | AlignConsecutiveMacros: AcrossEmptyLinesAndComments 8 | AlignEscapedNewlines: Left 9 | AlignOperands: Align 10 | AlignTrailingComments: true 11 | AllowAllArgumentsOnNextLine: false 12 | AllowAllParametersOfDeclarationOnNextLine: false 13 | AllowShortBlocksOnASingleLine: Never 14 | AllowShortCaseLabelsOnASingleLine: false 15 | AllowShortEnumsOnASingleLine: false 16 | AllowShortFunctionsOnASingleLine: None 17 | AllowShortIfStatementsOnASingleLine: false 18 | AllowShortLambdasOnASingleLine: All 19 | AllowShortLoopsOnASingleLine: false 20 | AlwaysBreakAfterReturnType: None 21 | AlwaysBreakBeforeMultilineStrings: false 22 | AlwaysBreakTemplateDeclarations: Yes 23 | BinPackArguments: false 24 | BinPackParameters: false 25 | BitFieldColonSpacing: Both 26 | BraceWrapping: 27 | AfterCaseLabel: true 28 | AfterClass: true 29 | AfterControlStatement: Always 30 | AfterEnum: true 31 | AfterExternBlock: false 32 | AfterFunction: true 33 | AfterNamespace: true 34 | AfterStruct: true 35 | AfterUnion: true 36 | BeforeCatch: true 37 | BeforeElse: true 38 | BeforeLambdaBody: false 39 | BeforeWhile: false 40 | IndentBraces: false 41 | SplitEmptyFunction: true 42 | SplitEmptyRecord: true 43 | SplitEmptyNamespace: true 44 | BreakBeforeBinaryOperators: None 45 | BreakBeforeBraces: Custom 46 | BreakBeforeConceptDeclarations: true 47 | BreakBeforeTernaryOperators: true 48 | BreakConstructorInitializers: BeforeColon 49 | BreakInheritanceList: BeforeColon 50 | BreakStringLiterals: true 51 | ColumnLimit: 80 52 | CompactNamespaces: false 53 | ContinuationIndentWidth: 4 54 | Cpp11BracedListStyle: false 55 | DeriveLineEnding: false 56 | DerivePointerAlignment: false 57 | EmptyLineBeforeAccessModifier: Always 58 | FixNamespaceComments: true 59 | IncludeBlocks: Preserve 60 | IndentCaseBlocks: false 61 | IndentCaseLabels: true 62 | IndentExternBlock: NoIndent 63 | IndentGotoLabels: true 64 | IndentPPDirectives: BeforeHash 65 | IndentWidth: 4 66 | KeepEmptyLinesAtTheStartOfBlocks: false 67 | MaxEmptyLinesToKeep: 1 68 | NamespaceIndentation: None 69 | PenaltyBreakAssignment: 1000 70 | PenaltyBreakBeforeFirstCallParameter: 200 71 | PenaltyBreakComment: 50 72 | PenaltyBreakFirstLessLess: 120 73 | PenaltyBreakString: 100 74 | PenaltyBreakTemplateDeclaration: 10 75 | PenaltyExcessCharacter: 100 76 | PenaltyIndentedWhitespace: 0 77 | PenaltyReturnTypeOnItsOwnLine: 10000 78 | PointerAlignment: Middle 79 | ReflowComments: true 80 | SortIncludes: true 81 | SortUsingDeclarations: true 82 | SpaceAfterCStyleCast: true 83 | SpaceAfterLogicalNot: false 84 | SpaceAfterTemplateKeyword: false 85 | SpaceBeforeCpp11BracedList: true 86 | SpaceBeforeCtorInitializerColon: false 87 | SpaceBeforeInheritanceColon: false 88 | SpaceBeforeParens: Never 89 | SpaceBeforeRangeBasedForLoopColon: false 90 | SpaceBeforeSquareBrackets: false 91 | SpaceInEmptyBlock: false 92 | SpaceInEmptyParentheses: false 93 | SpacesBeforeTrailingComments: 1 94 | SpacesInAngles: false 95 | SpacesInConditionalStatement: true 96 | SpacesInContainerLiterals: true 97 | SpacesInCStyleCastParentheses: true 98 | SpacesInParentheses: true 99 | SpacesInSquareBrackets: true 100 | TabWidth: 4 101 | UseCRLF: false 102 | UseTab: Never 103 | ... 104 | 105 | -------------------------------------------------------------------------------- /clang-formatting/filesWithFormattingErrors/testWithFormattingError.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | typedef struct DateAndTime 8 | { 9 | uint64_t hour; 10 | uint64_t minutes; 11 | uint64_t seconds; 12 | uint64_t msec; 13 | } DateAndTime; 14 | 15 | 16 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 17 | #include 18 | /* Remove the warning about implicit sleep even with windows.h included */ 19 | extern void sleep( int miliseconds ); 20 | void getTime( struct DateAndTime * currentTime ) 21 | { 22 | SYSTEMTIME st, lt; 23 | 24 | GetLocalTime( < ); 25 | currentTime->hour = lt.wHour; 26 | currentTime->minutes = lt.wMinute; 27 | currentTime->seconds = lt.wSecond; 28 | currentTime->msec = lt.wMilliseconds; 29 | } 30 | #else /* if defined( WIN32 ) || defined ( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 46 | 47 | int main( int argc, 48 | char ** argv ) 49 | { 50 | DateAndTime currentTime = { 0 }; 51 | int32_t loop = 0; 52 | int32_t totalLoops = 5U; 53 | int32_t exitCode = 0; 54 | 55 | if( argc == 1 ) 56 | { 57 | printf( "This is a basic test application .\n"); 58 | printf( "It prints the date and time and then sleeps for loopCount * 3\n" ); 59 | printf( "This program takes in two inputs, a loop count and an exit code\n" ); 60 | printf( "By default it will run %d loops and exit with exit status %d\n", totalLoops, exitCode ); 61 | } 62 | 63 | if( argc == 2 ) 64 | { 65 | totalLoops = atoi( argv[ 1 ] ); 66 | printf( "Will run for requested %d loops\n", totalLoops ); 67 | } 68 | 69 | if( argc == 3 ) 70 | { 71 | exitCode = atoi( argv[ 2 ] ); 72 | printf( "Will exit with supplied exit code %d\n", exitCode ); 73 | } 74 | 75 | setvbuf( stdout, NULL, _IONBF, 0 ); 76 | 77 | for(int i = 1U; i < totalLoops; i++ ) 78 | { 79 | getTime( ¤tTime ); 80 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d SECONDS\n", 81 | currentTime.hour, 82 | currentTime.minutes , 83 | currentTime.seconds, 84 | currentTime.msec, 85 | i * 3U ); 86 | sleep( i * 3U ); 87 | } 88 | 89 | #ifdef EXIT_WITH_MINUTES 90 | exitCode = currentTime.minutes; 91 | #endif 92 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n" 93 | , exitCode ); 94 | return exitCode; 95 | } 96 | -------------------------------------------------------------------------------- /ssl-credential-creator/ssl_credential_creator.py: -------------------------------------------------------------------------------- 1 | import random 2 | from OpenSSL import crypto, SSL 3 | 4 | # File names for generated credentials 5 | ROOT_CA_PRIV_KEY_FILE = "root_ca_priv_key.key" 6 | ROOT_CA_CERT_FILE = "root_ca_cert.crt" 7 | SERVER_PRIV_KEY_FILE = "server_priv_key.key" 8 | SERVER_CERT_FILE = "server_cert.crt" 9 | DEVICE_PRIV_KEY_FILE = "device_priv_key.key" 10 | DEVICE_CERT_FILE = "device_cert.crt" 11 | 12 | # Reusable certificate subject for testing 13 | TEST_CERT_SUBJECT = crypto.X509Name(crypto.X509().get_subject()) 14 | TEST_CERT_SUBJECT.C = 'US' 15 | TEST_CERT_SUBJECT.ST = 'Test_ST' 16 | TEST_CERT_SUBJECT.L = 'Test_L' 17 | TEST_CERT_SUBJECT.O = 'Test_O' 18 | TEST_CERT_SUBJECT.OU = 'Test_OU' 19 | TEST_CERT_SUBJECT.CN = 'localhost' 20 | TEST_CERT_SUBJECT.emailAddress = 'test@test.com' 21 | 22 | # Common name has to be different for the Root CA according to OpenSSL documents 23 | TEST_CERT_SUBJECT_ROOT_CA = crypto.X509Name(TEST_CERT_SUBJECT) 24 | TEST_CERT_SUBJECT_ROOT_CA.CN = 'localhostrootca' 25 | 26 | def generate_priv_keys_and_certs(): 27 | 28 | # Root CA generation 29 | 30 | ca_key_pair = crypto.PKey() 31 | ca_key_pair.generate_key(crypto.TYPE_RSA, 2048) 32 | ca_cert = crypto.X509() 33 | ca_cert.set_subject(TEST_CERT_SUBJECT_ROOT_CA) 34 | ca_cert.set_serial_number(random.getrandbits(64)) 35 | ca_cert.gmtime_adj_notBefore(0) 36 | ca_cert.gmtime_adj_notAfter(31536000) 37 | ca_cert.set_issuer(TEST_CERT_SUBJECT_ROOT_CA) 38 | ca_cert.set_pubkey(ca_key_pair) 39 | ca_cert.sign(ca_key_pair, "sha256") 40 | open(ROOT_CA_PRIV_KEY_FILE, "w").write(crypto.dump_privatekey(crypto.FILETYPE_PEM, ca_key_pair).decode("utf-8")) 41 | open(ROOT_CA_CERT_FILE, "w").write(crypto.dump_certificate(crypto.FILETYPE_PEM, ca_cert).decode("utf-8")) 42 | 43 | # Server credential generation 44 | 45 | server_key_pair = crypto.PKey() 46 | server_key_pair.generate_key(crypto.TYPE_RSA, 2048) 47 | server_cert = crypto.X509() 48 | server_cert.set_subject(TEST_CERT_SUBJECT) 49 | server_cert.set_serial_number(random.getrandbits(64)) 50 | server_cert.gmtime_adj_notBefore(0) 51 | server_cert.gmtime_adj_notAfter(31536000) 52 | server_cert.set_issuer(ca_cert.get_subject()) 53 | server_cert.set_pubkey(server_key_pair) 54 | server_cert.sign(ca_key_pair, "sha256") 55 | open(SERVER_PRIV_KEY_FILE, "w").write(crypto.dump_privatekey(crypto.FILETYPE_PEM, server_key_pair).decode("utf-8")) 56 | open(SERVER_CERT_FILE, "w").write(crypto.dump_certificate(crypto.FILETYPE_PEM, server_cert).decode("utf-8")) 57 | 58 | # Device credential generation 59 | 60 | device_key_pair = crypto.PKey() 61 | device_key_pair.generate_key(crypto.TYPE_RSA, 2048) 62 | device_cert = crypto.X509() 63 | device_cert.set_subject(TEST_CERT_SUBJECT) 64 | device_cert.set_serial_number(random.getrandbits(64)) 65 | device_cert.gmtime_adj_notBefore(0) 66 | device_cert.gmtime_adj_notAfter(31536000) 67 | device_cert.set_issuer(ca_cert.get_subject()) 68 | device_cert.set_pubkey(device_key_pair) 69 | device_cert.sign(ca_key_pair, "sha256") 70 | open(DEVICE_PRIV_KEY_FILE, "w").write(crypto.dump_privatekey(crypto.FILETYPE_PEM, device_key_pair).decode("utf-8")) 71 | open(DEVICE_CERT_FILE, "w").write(crypto.dump_certificate(crypto.FILETYPE_PEM, device_cert).decode("utf-8")) 72 | 73 | if __name__ == "__main__": 74 | generate_priv_keys_and_certs() 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### [CI-CD-Github-Actions](https://github.com/FreeRTOS/CI-CD-Github-Actions) 2 | 3 | This repository contains common GitHub Actions for use in CI/CD 4 | on [FreeRTOS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/main/FreeRTOS), and 5 | [AWS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/main/aws), Library 6 | Repositories. 7 | 8 | This currently includes: 9 | 10 | FreeRTOS Repositories: 11 | [FreeRTOS](https://github.com/FreeRTOS/FreeRTOS), 12 | [FreeRTOS-Kernel](https://github.com/FreeRTOS/FreeRTOS-Kernel), 13 | [FreeRTOS-Plus-TCP](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP), 14 | and [FreeRTOS-Cellular-Interface](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface), 15 | 16 | FreeRTOS-Library Repositories: 17 | [backoffAlgorithm](https://github.com/FreeRTOS/backoffAlgorithm), 18 | [coreHTTP](https://github.com/FreeRTOS/coreHTTP), 19 | [coreJSON](https://github.com/FreeRTOS/coreJSON), 20 | [coreMQTT](https://github.com/FreeRTOS/coreMQTT) 21 | [corePKCS11](https://github.com/FreeRTOS/corePKCS11), 22 | and [coreSNTP](https://github.com/FreeRTOS/coreSNTP), 23 | 24 | AWS-Library Repositories: 25 | [Device-Defender](https://github.com/aws/device-defender-for-aws-iot-embedded-sdk), 26 | [Device-Shadow](https://github.com/aws/device-shadow-for-aws-iot-embedded-sdk), 27 | [Fleet-Provisioning](https://github.com/aws/fleet-provisioning-for-aws-iot-embedded-sdk), 28 | [Jobs](https://github.com/aws/jobs-for-aws-iot-embedded-sdk), 29 | [Ota](https://github.com/aws/ota-for-aws-iot-embedded-sdk), 30 | and [Sigv4](https://github.com/aws/sigv4-for-aws-iot-embedded-sdk) 31 | 32 | 33 | Currently, this repository contains actions for the following code quality 34 | checks that are run on FreeRTOS libraries. 35 | 36 | * **Complexity** - Uses 37 | [GNU Complexity](https://www.gnu.org/software/complexity/manual/complexity.html) 38 | to verify that the complexity score of library functions is less than 16. 39 | 40 | * **[Clang-Formatting](https://clang.llvm.org/docs/ClangFormat.html)** - 41 | Validates all code files of a repository comply to the formatting 42 | standard defined in [clang-format](clang-formatting/.clang-format). 43 | 44 | * **[Uncrustify](https://github.com/uncrustify/uncrustify) Formatting** - 45 | Validates all files of a repository comply to the formatting 46 | standard defined in [uncrustify.cfg](formatting/uncrustify.cfg). 47 | 48 | * **Doxygen** - Validates that the doxygen manual of the repository can be 49 | built without warnings. 50 | 51 | * **Spellings** - Checks spelling, using [CSpell](https://cspell.org/), across 52 | all files of a repository. Each FreeRTOS library repository 53 | should have a **.github/.cSpellWords.txt** file. 54 | 55 | * **Coverage Cop** - Enforces that the unit tests of a FreeRTOS library meet 56 | the minimum thresholds branch and line coverages. The **lcov** coverage output 57 | from running unit tests should be available before using this action. 58 | 59 | * **Memory Statistics** - Generates table of memory estimates for library 60 | files used in FreeRTOS library documentation. The memory estimates are generated 61 | by building the library with the ARM GCC toolchain. 62 | 63 | * **Link Verifier** - Verifies links present in source and Markdown files. 64 | Links verified include HTTP. 65 | 66 | * **Manifest.yml Verifier** - Verifies that information of `manifest.yml` file 67 | matches the state of a repository for the presence of submodules 68 | and their commit IDs. 69 | 70 | URLs, and - for Markdown files - relative file path links and section anchors. -------------------------------------------------------------------------------- /clang-formatting/filesWithCRLFEndings/testWithCRLFEnding.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | static void prvQueueSendTask( void *pvParameters ) 28 | { 29 | TickType_t xNextWakeTime; 30 | const unsigned long ulValueToSend = 100UL; 31 | 32 | /* Check the task parameter is as expected. */ 33 | configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); 34 | 35 | /* Initialise xNextWakeTime - this only needs to be done once. */ 36 | xNextWakeTime = xTaskGetTickCount(); 37 | 38 | for( ;; ) 39 | { 40 | /* Place this task in the blocked state until it is time to run again. 41 | The block time is specified in ticks, the constant used converts ticks 42 | to ms. While in the Blocked state this task will not consume any CPU 43 | time. */ 44 | vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); 45 | 46 | /* Send to the queue - causing the queue receive task to unblock and 47 | toggle the LED. 0 is used as the block time so the sending operation 48 | will not block - it shouldn't need to block as the queue should always 49 | be empty at this point in the code. */ 50 | xQueueSend( xQueue, &ulValueToSend, 0U ); 51 | } 52 | } 53 | /*-----------------------------------------------------------*/ 54 | 55 | static void prvQueueReceiveTask( void *pvParameters ) 56 | { 57 | unsigned long ulReceivedValue; 58 | 59 | /* Check the task parameter is as expected. */ 60 | configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); 61 | 62 | for( ;; ) 63 | { 64 | /* Wait until something arrives in the queue - this task will block 65 | indefinitely provided INCLUDE_vTaskSuspend is set to 1 in 66 | FreeRTOSConfig.h. */ 67 | xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); 68 | 69 | /* To get here something must have been received from the queue, but 70 | is it the expected value? If it is, toggle the LED. */ 71 | if( ulReceivedValue == 100UL ) 72 | { 73 | /* Toggle the LED. */ 74 | port_pin_toggle_output_level( LED_0_PIN ); 75 | ulReceivedValue = 0U; 76 | } 77 | } 78 | } 79 | /*-----------------------------------------------------------*/ 80 | -------------------------------------------------------------------------------- /formatting/filesWithCRLFEndings/testWithCRLFEnding.c: -------------------------------------------------------------------------------- 1 | /* 2 | /* 3 | * FreeRTOS V202212.00 4 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | * this software and associated documentation files (the "Software"), to deal in 8 | * the Software without restriction, including without limitation the rights to 9 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | * the Software, and to permit persons to whom the Software is furnished to do so, 11 | * subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * https://www.FreeRTOS.org 24 | * https://github.com/FreeRTOS 25 | * 26 | */ 27 | 28 | static void prvQueueSendTask( void *pvParameters ) 29 | { 30 | TickType_t xNextWakeTime; 31 | const unsigned long ulValueToSend = 100UL; 32 | 33 | /* Check the task parameter is as expected. */ 34 | configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); 35 | 36 | /* Initialise xNextWakeTime - this only needs to be done once. */ 37 | xNextWakeTime = xTaskGetTickCount(); 38 | 39 | for( ;; ) 40 | { 41 | /* Place this task in the blocked state until it is time to run again. 42 | The block time is specified in ticks, the constant used converts ticks 43 | to ms. While in the Blocked state this task will not consume any CPU 44 | time. */ 45 | vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); 46 | 47 | /* Send to the queue - causing the queue receive task to unblock and 48 | toggle the LED. 0 is used as the block time so the sending operation 49 | will not block - it shouldn't need to block as the queue should always 50 | be empty at this point in the code. */ 51 | xQueueSend( xQueue, &ulValueToSend, 0U ); 52 | } 53 | } 54 | /*-----------------------------------------------------------*/ 55 | 56 | static void prvQueueReceiveTask( void *pvParameters ) 57 | { 58 | unsigned long ulReceivedValue; 59 | 60 | /* Check the task parameter is as expected. */ 61 | configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); 62 | 63 | for( ;; ) 64 | { 65 | /* Wait until something arrives in the queue - this task will block 66 | indefinitely provided INCLUDE_vTaskSuspend is set to 1 in 67 | FreeRTOSConfig.h. */ 68 | xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); 69 | 70 | /* To get here something must have been received from the queue, but 71 | is it the expected value? If it is, toggle the LED. */ 72 | if( ulReceivedValue == 100UL ) 73 | { 74 | /* Toggle the LED. */ 75 | port_pin_toggle_output_level( LED_0_PIN ); 76 | ulReceivedValue = 0U; 77 | } 78 | } 79 | } 80 | /*-----------------------------------------------------------*/ 81 | 82 | -------------------------------------------------------------------------------- /formatting/goodFiles/source/formatErrorTest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | 18 | 19 | 20 | 21 | 22 | 23 | /* Remove the warning about implicit sleep even with windows.h included */ 24 | extern void sleep( int miliseconds ); 25 | 26 | 27 | void getTime( struct DateAndTime * currentTime ) 28 | { 29 | SYSTEMTIME st, lt; 30 | 31 | GetLocalTime( < ); 32 | currentTime->hour = lt.wHour; 33 | currentTime->minutes = lt.wMinute; 34 | currentTime->seconds = lt.wSecond; 35 | currentTime->msec = lt.wMilliseconds; 36 | } 37 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 38 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 39 | #include 40 | #include 41 | void getTime( struct DateAndTime * currentTime ) 42 | { 43 | struct timeval tv; 44 | struct tm * tm; 45 | 46 | gettimeofday( &tv, NULL ); 47 | tm = localtime( &tv.tv_sec ); 48 | currentTime->hour = tm->tm_hour; 49 | currentTime->minutes = tm->tm_min; 50 | currentTime->seconds = tm->tm_sec; 51 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 52 | } 53 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 54 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 55 | 56 | int main( int argc, char ** argv ) 57 | { 58 | DateAndTime currentTime = { 0 }; 59 | int32_t loop = 0; 60 | int32_t totalLoops = 5U; 61 | int32_t exitCode = 0; 62 | 63 | if( argc == 1 ) 64 | { 65 | printf( "This is a basic test application.\n" ); 66 | printf( 67 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 68 | printf( "This program takes in two inputs, a loop count and an exit " 69 | "code\n" ); 70 | printf( "By default it will run %d loops and exit with exit status " 71 | "%d\n", 72 | totalLoops, 73 | exitCode ); 74 | } 75 | 76 | if( argc == 2 ) 77 | { 78 | totalLoops = atoi( argv[ 1 ] ); 79 | printf( "Will run for requested %d loops\n", totalLoops ); 80 | } 81 | 82 | if( argc == 3 ) 83 | { 84 | exitCode = atoi( argv[ 2 ] ); 85 | printf( "Will exit with supplied exit code %d\n", exitCode ); 86 | } 87 | 88 | setvbuf( stdout, NULL, _IONBF, 0 ); 89 | 90 | for( int i = 1U; i < totalLoops; i++ ) 91 | { 92 | getTime( ¤tTime ); 93 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 94 | "SECONDS\n", 95 | currentTime.hour, 96 | currentTime.minutes, 97 | currentTime.seconds, 98 | currentTime.msec, 99 | i * 3U ); 100 | sleep( i * 3U ); 101 | } 102 | 103 | #ifdef EXIT_WITH_MINUTES 104 | exitCode = currentTime.minutes; 105 | #endif 106 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 107 | return exitCode; 108 | } 109 | -------------------------------------------------------------------------------- /clang-formatting/goodFiles/source/formatErrorTest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | 18 | 19 | 20 | 21 | 22 | 23 | /* Remove the warning about implicit sleep even with windows.h included */ 24 | extern void sleep( int miliseconds ); 25 | 26 | 27 | void getTime( struct DateAndTime * currentTime ) 28 | { 29 | SYSTEMTIME st, lt; 30 | 31 | GetLocalTime( < ); 32 | currentTime->hour = lt.wHour; 33 | currentTime->minutes = lt.wMinute; 34 | currentTime->seconds = lt.wSecond; 35 | currentTime->msec = lt.wMilliseconds; 36 | } 37 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 38 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 39 | #include 40 | #include 41 | void getTime( struct DateAndTime * currentTime ) 42 | { 43 | struct timeval tv; 44 | struct tm * tm; 45 | 46 | gettimeofday( &tv, NULL ); 47 | tm = localtime( &tv.tv_sec ); 48 | currentTime->hour = tm->tm_hour; 49 | currentTime->minutes = tm->tm_min; 50 | currentTime->seconds = tm->tm_sec; 51 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 52 | } 53 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 54 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 55 | 56 | int main( int argc, char ** argv ) 57 | { 58 | DateAndTime currentTime = { 0 }; 59 | int32_t loop = 0; 60 | int32_t totalLoops = 5U; 61 | int32_t exitCode = 0; 62 | 63 | if( argc == 1 ) 64 | { 65 | printf( "This is a basic test application.\n" ); 66 | printf( 67 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 68 | printf( "This program takes in two inputs, a loop count and an exit " 69 | "code\n" ); 70 | printf( "By default it will run %d loops and exit with exit status " 71 | "%d\n", 72 | totalLoops, 73 | exitCode ); 74 | } 75 | 76 | if( argc == 2 ) 77 | { 78 | totalLoops = atoi( argv[ 1 ] ); 79 | printf( "Will run for requested %d loops\n", totalLoops ); 80 | } 81 | 82 | if( argc == 3 ) 83 | { 84 | exitCode = atoi( argv[ 2 ] ); 85 | printf( "Will exit with supplied exit code %d\n", exitCode ); 86 | } 87 | 88 | setvbuf( stdout, NULL, _IONBF, 0 ); 89 | 90 | for( int i = 1U; i < totalLoops; i++ ) 91 | { 92 | getTime( ¤tTime ); 93 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 94 | "SECONDS\n", 95 | currentTime.hour, 96 | currentTime.minutes, 97 | currentTime.seconds, 98 | currentTime.msec, 99 | i * 3U ); 100 | sleep( i * 3U ); 101 | } 102 | 103 | #ifdef EXIT_WITH_MINUTES 104 | exitCode = currentTime.minutes; 105 | #endif 106 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 107 | return exitCode; 108 | } 109 | -------------------------------------------------------------------------------- /formatting/goodFiles/source/goodSource.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 30 | * defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | * defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, 49 | char ** argv ) 50 | { 51 | DateAndTime currentTime = { 0 }; 52 | int32_t loop = 0; 53 | int32_t totalLoops = 5U; 54 | int32_t exitCode = 0; 55 | 56 | if( argc == 1 ) 57 | { 58 | printf( "This is a basic test application.\n" ); 59 | printf( 60 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 61 | printf( "This program takes in two inputs, a loop count and an exit " 62 | "code\n" ); 63 | printf( "By default it will run %d loops and exit with exit status " 64 | "%d\n", 65 | totalLoops, 66 | exitCode ); 67 | } 68 | 69 | if( argc == 2 ) 70 | { 71 | totalLoops = atoi( argv[ 1 ] ); 72 | printf( "Will run for requested %d loops\n", totalLoops ); 73 | } 74 | 75 | if( argc == 3 ) 76 | { 77 | exitCode = atoi( argv[ 2 ] ); 78 | printf( "Will exit with supplied exit code %d\n", exitCode ); 79 | } 80 | 81 | setvbuf( stdout, NULL, _IONBF, 0 ); 82 | 83 | for( int i = 1U; i < totalLoops; i++ ) 84 | { 85 | getTime( ¤tTime ); 86 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 87 | "SECONDS\n", 88 | currentTime.hour, 89 | currentTime.minutes, 90 | currentTime.seconds, 91 | currentTime.msec, 92 | i * 3U ); 93 | sleep( i * 3U ); 94 | } 95 | 96 | #ifdef EXIT_WITH_MINUTES 97 | exitCode = currentTime.minutes; 98 | #endif 99 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 100 | return exitCode; 101 | } 102 | -------------------------------------------------------------------------------- /formatting/goodFiles/source/goodSourceTwo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 30 | * defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | * defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, 49 | char ** argv ) 50 | { 51 | DateAndTime currentTime = { 0 }; 52 | int32_t loop = 0; 53 | int32_t totalLoops = 5U; 54 | int32_t exitCode = 0; 55 | 56 | if( argc == 1 ) 57 | { 58 | printf( "This is a basic test application.\n" ); 59 | printf( 60 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 61 | printf( "This program takes in two inputs, a loop count and an exit " 62 | "code\n" ); 63 | printf( "By default it will run %d loops and exit with exit status " 64 | "%d\n", 65 | totalLoops, 66 | exitCode ); 67 | } 68 | 69 | if( argc == 2 ) 70 | { 71 | totalLoops = atoi( argv[ 1 ] ); 72 | printf( "Will run for requested %d loops\n", totalLoops ); 73 | } 74 | 75 | if( argc == 3 ) 76 | { 77 | exitCode = atoi( argv[ 2 ] ); 78 | printf( "Will exit with supplied exit code %d\n", exitCode ); 79 | } 80 | 81 | setvbuf( stdout, NULL, _IONBF, 0 ); 82 | 83 | for( int i = 1U; i < totalLoops; i++ ) 84 | { 85 | getTime( ¤tTime ); 86 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 87 | "SECONDS\n", 88 | currentTime.hour, 89 | currentTime.minutes, 90 | currentTime.seconds, 91 | currentTime.msec, 92 | i * 3U ); 93 | sleep( i * 3U ); 94 | } 95 | 96 | #ifdef EXIT_WITH_MINUTES 97 | exitCode = currentTime.minutes; 98 | #endif 99 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 100 | return exitCode; 101 | } 102 | -------------------------------------------------------------------------------- /formatting/goodFiles/source/fileWithErrorSource/errorFileInDirectory.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | 18 | 19 | 20 | 21 | 22 | 23 | /* Remove the warning about implicit sleep even with windows.h included */ 24 | extern void sleep( int miliseconds ); 25 | 26 | 27 | void getTime( struct DateAndTime * currentTime ) 28 | { 29 | SYSTEMTIME st, lt; 30 | 31 | GetLocalTime( < ); 32 | currentTime->hour = lt.wHour; 33 | currentTime->minutes = lt.wMinute; 34 | currentTime->seconds = lt.wSecond; 35 | currentTime->msec = lt.wMilliseconds; 36 | } 37 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 38 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 39 | #include 40 | #include 41 | void getTime( struct DateAndTime * currentTime ) 42 | { 43 | struct timeval tv; 44 | struct tm * tm; 45 | 46 | gettimeofday( &tv, NULL ); 47 | tm = localtime( &tv.tv_sec ); 48 | currentTime->hour = tm->tm_hour; 49 | currentTime->minutes = tm->tm_min; 50 | currentTime->seconds = tm->tm_sec; 51 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 52 | } 53 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 54 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 55 | 56 | int main( int argc, char ** argv ) 57 | { 58 | DateAndTime currentTime = { 0 }; 59 | int32_t loop = 0; 60 | int32_t totalLoops = 5U; 61 | int32_t exitCode = 0; 62 | 63 | if( argc == 1 ) 64 | { 65 | printf( "This is a basic test application.\n" ); 66 | printf( 67 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 68 | printf( "This program takes in two inputs, a loop count and an exit " 69 | "code\n" ); 70 | printf( "By default it will run %d loops and exit with exit status " 71 | "%d\n", 72 | totalLoops, 73 | exitCode ); 74 | } 75 | 76 | if( argc == 2 ) 77 | { 78 | totalLoops = atoi( argv[ 1 ] ); 79 | printf( "Will run for requested %d loops\n", totalLoops ); 80 | } 81 | 82 | if( argc == 3 ) 83 | { 84 | exitCode = atoi( argv[ 2 ] ); 85 | printf( "Will exit with supplied exit code %d\n", exitCode ); 86 | } 87 | 88 | setvbuf( stdout, NULL, _IONBF, 0 ); 89 | 90 | for( int i = 1U; i < totalLoops; i++ ) 91 | { 92 | getTime( ¤tTime ); 93 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 94 | "SECONDS\n", 95 | currentTime.hour, 96 | currentTime.minutes, 97 | currentTime.seconds, 98 | currentTime.msec, 99 | i * 3U ); 100 | sleep( i * 3U ); 101 | } 102 | 103 | #ifdef EXIT_WITH_MINUTES 104 | exitCode = currentTime.minutes; 105 | #endif 106 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 107 | return exitCode; 108 | } 109 | -------------------------------------------------------------------------------- /formatting/goodFiles/source/goodSourceThree.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 30 | * defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | * defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, 49 | char ** argv ) 50 | { 51 | DateAndTime currentTime = { 0 }; 52 | int32_t loop = 0; 53 | int32_t totalLoops = 5U; 54 | int32_t exitCode = 0; 55 | 56 | if( argc == 1 ) 57 | { 58 | printf( "This is a basic test application.\n" ); 59 | printf( 60 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 61 | printf( "This program takes in two inputs, a loop count and an exit " 62 | "code\n" ); 63 | printf( "By default it will run %d loops and exit with exit status " 64 | "%d\n", 65 | totalLoops, 66 | exitCode ); 67 | } 68 | 69 | if( argc == 2 ) 70 | { 71 | totalLoops = atoi( argv[ 1 ] ); 72 | printf( "Will run for requested %d loops\n", totalLoops ); 73 | } 74 | 75 | if( argc == 3 ) 76 | { 77 | exitCode = atoi( argv[ 2 ] ); 78 | printf( "Will exit with supplied exit code %d\n", exitCode ); 79 | } 80 | 81 | setvbuf( stdout, NULL, _IONBF, 0 ); 82 | 83 | for( int i = 1U; i < totalLoops; i++ ) 84 | { 85 | getTime( ¤tTime ); 86 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 87 | "SECONDS\n", 88 | currentTime.hour, 89 | currentTime.minutes, 90 | currentTime.seconds, 91 | currentTime.msec, 92 | i * 3U ); 93 | sleep( i * 3U ); 94 | } 95 | 96 | #ifdef EXIT_WITH_MINUTES 97 | exitCode = currentTime.minutes; 98 | #endif 99 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 100 | return exitCode; 101 | } 102 | -------------------------------------------------------------------------------- /clang-formatting/goodFiles/source/fileWithErrorSource/errorFileInDirectory.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | 18 | 19 | 20 | 21 | 22 | 23 | /* Remove the warning about implicit sleep even with windows.h included */ 24 | extern void sleep( int miliseconds ); 25 | 26 | 27 | void getTime( struct DateAndTime * currentTime ) 28 | { 29 | SYSTEMTIME st, lt; 30 | 31 | GetLocalTime( < ); 32 | currentTime->hour = lt.wHour; 33 | currentTime->minutes = lt.wMinute; 34 | currentTime->seconds = lt.wSecond; 35 | currentTime->msec = lt.wMilliseconds; 36 | } 37 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 38 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 39 | #include 40 | #include 41 | void getTime( struct DateAndTime * currentTime ) 42 | { 43 | struct timeval tv; 44 | struct tm * tm; 45 | 46 | gettimeofday( &tv, NULL ); 47 | tm = localtime( &tv.tv_sec ); 48 | currentTime->hour = tm->tm_hour; 49 | currentTime->minutes = tm->tm_min; 50 | currentTime->seconds = tm->tm_sec; 51 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 52 | } 53 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 54 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 55 | 56 | int main( int argc, char ** argv ) 57 | { 58 | DateAndTime currentTime = { 0 }; 59 | int32_t loop = 0; 60 | int32_t totalLoops = 5U; 61 | int32_t exitCode = 0; 62 | 63 | if( argc == 1 ) 64 | { 65 | printf( "This is a basic test application.\n" ); 66 | printf( 67 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 68 | printf( "This program takes in two inputs, a loop count and an exit " 69 | "code\n" ); 70 | printf( "By default it will run %d loops and exit with exit status " 71 | "%d\n", 72 | totalLoops, 73 | exitCode ); 74 | } 75 | 76 | if( argc == 2 ) 77 | { 78 | totalLoops = atoi( argv[ 1 ] ); 79 | printf( "Will run for requested %d loops\n", totalLoops ); 80 | } 81 | 82 | if( argc == 3 ) 83 | { 84 | exitCode = atoi( argv[ 2 ] ); 85 | printf( "Will exit with supplied exit code %d\n", exitCode ); 86 | } 87 | 88 | setvbuf( stdout, NULL, _IONBF, 0 ); 89 | 90 | for( int i = 1U; i < totalLoops; i++ ) 91 | { 92 | getTime( ¤tTime ); 93 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 94 | "SECONDS\n", 95 | currentTime.hour, 96 | currentTime.minutes, 97 | currentTime.seconds, 98 | currentTime.msec, 99 | i * 3U ); 100 | sleep( i * 3U ); 101 | } 102 | 103 | #ifdef EXIT_WITH_MINUTES 104 | exitCode = currentTime.minutes; 105 | #endif 106 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 107 | return exitCode; 108 | } 109 | -------------------------------------------------------------------------------- /formatting/goodFiles/source/fileWithErrorSource/goodTest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct DateAndTime 7 | { 8 | uint64_t hour; 9 | uint64_t minutes; 10 | uint64_t seconds; 11 | uint64_t msec; 12 | } DateAndTime; 13 | 14 | #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 15 | defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) 16 | #include 17 | /* Remove the warning about implicit sleep even with windows.h included */ 18 | extern void sleep( int miliseconds ); 19 | void getTime( struct DateAndTime * currentTime ) 20 | { 21 | SYSTEMTIME st, lt; 22 | 23 | GetLocalTime( < ); 24 | currentTime->hour = lt.wHour; 25 | currentTime->minutes = lt.wMinute; 26 | currentTime->seconds = lt.wSecond; 27 | currentTime->msec = lt.wMilliseconds; 28 | } 29 | #else /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 30 | * defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 31 | #include 32 | #include 33 | void getTime( struct DateAndTime * currentTime ) 34 | { 35 | struct timeval tv; 36 | struct tm * tm; 37 | 38 | gettimeofday( &tv, NULL ); 39 | tm = localtime( &tv.tv_sec ); 40 | currentTime->hour = tm->tm_hour; 41 | currentTime->minutes = tm->tm_min; 42 | currentTime->seconds = tm->tm_sec; 43 | currentTime->msec = ( int ) ( tv.tv_usec / 1000 ); 44 | } 45 | #endif /* if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || \ 46 | * defined( __NT__ ) || defined( WIN64 ) || defined( __WIN64 ) */ 47 | 48 | int main( int argc, 49 | char ** argv ) 50 | { 51 | DateAndTime currentTime = { 0 }; 52 | int32_t loop = 0; 53 | int32_t totalLoops = 5U; 54 | int32_t exitCode = 0; 55 | 56 | if( argc == 1 ) 57 | { 58 | printf( "This is a basic test application.\n" ); 59 | printf( 60 | "It prints the date and time and then sleeps for loopCount * 3\n" ); 61 | printf( "This program takes in two inputs, a loop count and an exit " 62 | "code\n" ); 63 | printf( "By default it will run %d loops and exit with exit status " 64 | "%d\n", 65 | totalLoops, 66 | exitCode ); 67 | } 68 | 69 | if( argc == 2 ) 70 | { 71 | totalLoops = atoi( argv[ 1 ] ); 72 | printf( "Will run for requested %d loops\n", totalLoops ); 73 | } 74 | 75 | if( argc == 3 ) 76 | { 77 | exitCode = atoi( argv[ 2 ] ); 78 | printf( "Will exit with supplied exit code %d\n", exitCode ); 79 | } 80 | 81 | setvbuf( stdout, NULL, _IONBF, 0 ); 82 | 83 | for( int i = 1U; i < totalLoops; i++ ) 84 | { 85 | getTime( ¤tTime ); 86 | printf( "%02llu:%02llu:%02llu.%03llu TEST APPLICATION SLEEPING FOR %d " 87 | "SECONDS\n", 88 | currentTime.hour, 89 | currentTime.minutes, 90 | currentTime.seconds, 91 | currentTime.msec, 92 | i * 3U ); 93 | sleep( i * 3U ); 94 | } 95 | 96 | #ifdef EXIT_WITH_MINUTES 97 | exitCode = currentTime.minutes; 98 | #endif 99 | printf( "EXITING TEST APPLICATION WITH EXIT CODE = %d\n", exitCode ); 100 | return exitCode; 101 | } 102 | -------------------------------------------------------------------------------- /memory_statistics/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Generate memory estimates' 2 | description: 'Generate library size tables for doxygen.' 3 | inputs: 4 | path: 5 | description: 'Path to library directory.' 6 | required: false 7 | default: ./ 8 | config: 9 | description: 'JSON config file containing library information to be used for memory estimation.' 10 | required: true 11 | output: 12 | description: 'File to write generated table to.' 13 | required: false 14 | default: 'size_table.html' 15 | check_against: 16 | description: > 17 | Path to existing memory estimates file to compare with the memory estimates calculated by 18 | the action. Action will fail if sizes do not match to indicate need for updating size. 19 | required: false 20 | default: '' 21 | toolchain_link: 22 | description: 'Link to ARM GCC tar.bz2 to use for compiling files (default version 9-2020-q2).' 23 | required: false 24 | default: "https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2?revision=05382cca-1721-44e1-ae19-1e7c3dc96118&la=en&hash=D7C9D18FCA2DD9F894FD9F3C3DC9228498FA281A" 25 | 26 | runs: 27 | using: "composite" 28 | steps: 29 | - env: 30 | bashPass: \033[32;1mPASSED - 31 | bashInfo: \033[33;1mINFO - 32 | bashFail: \033[31;1mFAILED - 33 | bashEnd: \033[0m 34 | stepName: Install ARM GCC 35 | name: ${{ env.stepName }} 36 | shell: bash 37 | run: | 38 | # ${{ env.stepName }} 39 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 40 | wget -qO- "${{ inputs.toolchain_link }}" | sudo tar --strip-components=1 -xj -C /usr/local 41 | echo -e "::endgroup::" 42 | echo -e "::group::${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 43 | 44 | - env: 45 | bashPass: \033[32;1mPASSED - 46 | bashInfo: \033[33;1mINFO - 47 | bashFail: \033[31;1mFAILED - 48 | bashEnd: \033[0m 49 | stepName: Compute File Sizes 50 | name: ${{ env.stepName }} 51 | working-directory: ${{ inputs.path }} 52 | shell: bash 53 | run: | 54 | # ${{ env.stepName }} 55 | echo -e "${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 56 | ${{ github.action_path }}/memory_statistics.py --config "${{ inputs.config }}" --output "${{ inputs.output }}" 57 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 58 | 59 | - env: 60 | bashPass: \033[32;1mPASSED - 61 | bashInfo: \033[33;1mINFO - 62 | bashFail: \033[31;1mFAILED - 63 | bashEnd: \033[0m 64 | stepName: Check File Size 65 | name: ${{ env.stepName }} 66 | working-directory: ${{ inputs.path }} 67 | shell: bash 68 | if: inputs.check_against 69 | run: | 70 | # ${{ env.stepName }} 71 | echo -e "${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 72 | if cmp "${{ inputs.check_against }}" "${{ inputs.output }}" ; then 73 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 74 | exit 0 75 | else 76 | echo -e "::endgroup::" 77 | echo -e "::group::${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}" 78 | echo -e "${{ env.bashFail }} Sizes of files from provided ${{ inputs.check_against }} are not equal to current file size! ${{ env.bashEnd }}" 79 | diff -U 2 "${{ inputs.check_against }}" "${{ inputs.output }}" 80 | exit 1 81 | fi 82 | -------------------------------------------------------------------------------- /sbom-generator/sbom_utils.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | import re 3 | from datetime import datetime 4 | 5 | SPDX_VERSION = 'SPDX-2.2' 6 | DATA_LICENSE = 'CC0-1.0' 7 | CREATOR = 'Amazon Web Services' 8 | 9 | def hash_sha1(file_path: str) -> str: 10 | BLOCKSIZE = 65536 11 | hasher = hashlib.sha1() 12 | with open(file_path, 'rb') as afile: 13 | buf = afile.read(BLOCKSIZE) 14 | while len(buf) > 0: 15 | hasher.update(buf) 16 | buf = afile.read(BLOCKSIZE) 17 | return hasher.hexdigest() 18 | 19 | def package_hash(file_list: str) -> str: 20 | sorted(file_list) 21 | h = hashlib.sha1("".join(file_list).encode()) 22 | return h.hexdigest() 23 | 24 | def file_writer(output, filepath: str, sha1: str, license: str, copyright='NOASSERTION', comment='NOASSERTION'): 25 | output.write('FileName: .'+ filepath + '\n') 26 | output.write('SPDXID: SPDXRef-File'+ filepath.replace('/', '-').replace('_', '') + '\n') 27 | output.write('FileChecksum: SHA1: '+ sha1 + '\n') 28 | output.write('LicenseConcluded: '+ license + '\n') 29 | output.write('FileCopyrightText: '+ copyright + '\n') 30 | output.write('FileComment: '+ comment + '\n') 31 | output.write('\n') 32 | 33 | def cpe_writer(output, packageName: str, version: str): 34 | #Example: release/v6.0.5 -> v6.0.5 35 | version_stripped = re.sub(r'.*/', '', version) 36 | #Example: v6.0.5 -> 6.0.5 37 | version_stripped = re.sub('^v', '', version_stripped) 38 | 39 | #Map package name to part:vendor:product 40 | # Note: All of these have existing CPEs in the NVD 41 | specifier_lookup = { 42 | 'FreeRTOS-Kernel': 'o:amazon:freertos:', 43 | 'FreeRTOS-Plus-FAT': 'o:amazon:freertos\\+fat:', 44 | 'mbedtls': 'a:arm:mbed_tls:', 45 | 'llhttp': 'a:llhttp:llhttp:', 46 | } 47 | 48 | #If there are no existing CPEs in NVD -- nothing to do for now 49 | if packageName in specifier_lookup: 50 | output.write('ExternalRef: SECURITY cpe23Type cpe:2.3:' + specifier_lookup[packageName] + version_stripped + ':*:*:*:*:*:*:*' + '\n') 51 | 52 | def package_writer(output, packageName: str, version: str, url: str, license: str, ver_code: str, file_analyzed=True, 53 | copyright='NOASSERTION', summary='NOASSERTION', description='NOASSERTION', file_licenses='NOASSERTION'): 54 | output.write('PackageName: '+ packageName + '\n') 55 | output.write('SPDXID: SPDXRef-Package-'+ packageName + '\n') 56 | output.write('PackageVersion: '+ version + '\n') 57 | cpe_writer(output, packageName, version) 58 | output.write('PackageDownloadLocation: '+ url + '\n') 59 | output.write('PackageLicenseDeclared: ' + license + '\n') 60 | output.write('PackageLicenseConcluded: '+ license + '\n') 61 | output.write('PackageLicenseInfoFromFiles: '+ file_licenses + '\n') 62 | output.write('FilesAnalyzed: '+ str(file_analyzed).lower() + '\n') 63 | output.write('PackageVerificationCode: '+ ver_code + '\n') 64 | output.write('PackageCopyrightText: '+ copyright + '\n') 65 | output.write('PackageSummary: '+ summary + '\n') 66 | output.write('PackageDescription: '+ description + '\n') 67 | output.write('\n') 68 | 69 | def doc_writer(output, version: str, name: str, creator_comment='NOASSERTION', 70 | doc_comment='NOASSERTION'): 71 | today = datetime.now() 72 | namespace = 'https://github.com/FreeRTOS/'+name+'/blob/'+version+'/sbom.spdx' 73 | output.write('SPDXVersion: ' + SPDX_VERSION + '\n') 74 | output.write('DataLicense: ' + DATA_LICENSE + '\n') 75 | output.write('SPDXID: SPDXRef-DOCUMENT\n') 76 | output.write('DocumentName: ' + name + '\n') 77 | output.write('DocumentNamespace: ' + namespace + '\n') 78 | output.write('Creator: Organization:' + CREATOR + '\n') 79 | output.write('Created: ' + today.isoformat()[:-7] + 'Z\n') 80 | output.write('CreatorComment: ' + creator_comment + '\n') 81 | output.write('DocumentComment: ' + doc_comment + '\n') 82 | output.write('\n') 83 | -------------------------------------------------------------------------------- /link-verifier/README.md: -------------------------------------------------------------------------------- 1 | # Link Verification Script 2 | 3 | ## Pre-Requisites 4 | 5 | - Unix/Linux system 6 | - Python3 7 | - [pandoc](https://github.com/jgm/pandoc). Used to convert Markdown files to HTML, which are then searched. 8 | - [GitHub CLI](https://github.com/cli/cli). Optional, but recommended to speed up the testing of links involving GitHub issues and pull requests. 9 | - See [requirements.txt](requirements.txt) for versions of Python packages. This script uses beautfulsoup4, requests, and termcolor. 10 | 11 | ## Usage 12 | 13 | ```bash 14 | python3 tools/link-verifier/verify-links.py -F [MARKDOWN_FILE_LIST] -L [URL_LIST] 15 | ``` 16 | The script will print URLs that were not accessible. For Markdown files, it will also test relative paths to files, and anchors within the same document. 17 | 18 | ### Allowlist 19 | 20 | An allow list file contains a list of non-existent URLs used as placeholder examples in a repository. 21 | 22 | ### Example 23 | 24 | Run the script with a list of space separated names of directories to exclude. Optionally increase verbosity to print all links. 25 | 26 | ```bash 27 | ./links-verifier/verify-links.py --test-markdown --exclude-dirs third-party cmock --include-file-types .c .h .dox --verbose 28 | ``` 29 | 30 | Optionally, run the script with a custom user agent. 31 | 32 | ```bash 33 | ./links-verifier/verify-links.py --test-markdown --include-file-types .c .h --user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9" 34 | ``` 35 | 36 | Alternatively, run the script with a list of files (and/or) links that you want to test specifically. 37 | 38 | ```bash 39 | ./links-verifier/verify-links.py --files README.md --links https://mosquitto.org --verbose 40 | ``` 41 | 42 | ## Command Line Options 43 | 44 | The `--links` and `--include-file-types` options are mutually exclusive i.e. if the former is passed, then the script does not search for URLs in the repository, but if the latter is passed, then the script looks for URLs across the specified file type patterns in repository. If both options are passed, then `--links` will take precedence. 45 | The `--files` and `--test-markdown` options are mutually exclusive i.e. if the former is passed, then the script tests links only in the passed list of files, but if the 46 | latter is passed, then the script searches Markdown files and tests URLs, anchors and relative-file path in them. If both options are passed, then `--files` will take precedence. 47 | The `--exclude-dirs` option is only relevant to the `--test-markdown` and `--include-file-types` options. 48 | The `--user-agent` option allows specifying a specific user agent string to be used when making HTTP requests. 49 | 50 | | Option | Argument | Description | 51 | | --- | --- | --- | 52 | | `-F`, `--files` | 1 or more space-separated filepaths | Filepaths to verify links. Filepaths may be absolute or relative. | 53 | | `-L`, `--links` | 1 or more space-separated URLs | List of URLs to test. URLs should be separated by spaces. | 54 | | `-M`, `--test-markdown` | *None* | Option to enable search and testing of Markdown files. | 55 | | `-I`, `--include-file-types` | 1 or more space-separated file patterns | List of file patterns whose URLs will be tested. File Patterns should be separated by spaces. | 56 | | `-D`, `--exclude-dirs` | 1 or more space-separated directory names | List of directories to ignore for Markdown files and URL search. Directories should be separated by spaces. | 57 | | `-A`, `--allowlist-file` | Allowlist of URLs | Path to file containing list of URLs excused from link verification. | 58 | | `-n`, `--num-processes` | Integer | Number of threads to run in parallel when generating HTML files from Markdown. Each link is still tested serially, however. | 59 | | `-k`, `--keep` | *None* | Option to keep temporary HTML files instead of deleting them. Only useful for debugging. | 60 | | `-v`, `--verbose` | *None* | Increase verbosity to print all files and links tested, instead of only errors. | 61 | | `-u`, `--user-agent`| A User-Agent string | User agent string to use for HTTP requests. | 62 | 63 | ## Tests 64 | The various files that live inside of this directory are used in the PR checks 65 | for this repository. The relevant tests for this action can be found inside of 66 | [test.yml](../.github/workflows/test.yml) 67 | -------------------------------------------------------------------------------- /executable-monitor/action.yml: -------------------------------------------------------------------------------- 1 | name: 'executable-monitor' 2 | description: 'Runs and executable until a termination line is hit or a timeout occurs. Reports if the executable completed successfully or failed.' 3 | inputs: 4 | exe-path: 5 | description: 'Path to the executable to run.' 6 | required: true 7 | log-dir: 8 | description: 'Path to directory to store logs.' 9 | required: false 10 | success-line: 11 | description: 'Line of output from executable indicating success.' 12 | required: false 13 | timeout-seconds: 14 | description: 'Maximum amount of time to run the executable. Default is 180.' 15 | required: false 16 | default: 180 17 | retry-attempts: 18 | description: 'Number of times to re-launch the binary to check for success.' 19 | required: false 20 | default: 0 21 | success-exit-code: 22 | description: 'Exit status that indicates that the executable completed successfully. Required if --success-line is not used.' 23 | required: false 24 | 25 | runs: 26 | using: "composite" 27 | steps: 28 | - env: 29 | # The bash escape character is \033 30 | # At time of writing, you can't add a global environment to an 31 | # action so stuck with this. If this gets changed please move this 32 | bashPass: \033[32;1mPASSED - 33 | bashInfo: \033[33;1mINFO - 34 | bashFail: \033[31;1mFAILED - 35 | bashEnd: \033[0m 36 | stepName: Install Dependencies 37 | name: ${{ env.stepName }} 38 | shell: bash 39 | run: | 40 | # ${{ env.stepName }} 41 | echo -e "::group::Install Dependencies" 42 | pip install -r $GITHUB_ACTION_PATH/requirements.txt 43 | exitStatus=$? 44 | echo -e "::endgroup::" 45 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 46 | 47 | - env: 48 | bashPass: \033[32;1mPASSED - 49 | bashInfo: \033[33;1mINFO - 50 | bashFail: \033[31;1mFAILED - 51 | bashEnd: \033[0m 52 | stepName: Run Executable with Monitoring 53 | name: ${{ env.stepName }} 54 | shell: bash 55 | run: | 56 | # Run Executable with Monitoring 57 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 58 | 59 | # Make sure we have an exit condition to look for 60 | if [ "${{ inputs.success-exit-code }}" = "" ] && [ "${{ inputs.success-line }}" = "" ]; then 61 | echo -e "::endgroup::\n${{ env.bashFail}} Did not supply an input of success-line or success-exit-code to search for ${{ env.bashEnd }}" 62 | exit 1 63 | fi 64 | 65 | # Initial Arguments 66 | args="$GITHUB_ACTION_PATH/executable-monitor.py --exe-path=${{ inputs.exe-path }}" 67 | args+=" --timeout-seconds=${{ inputs.timeout-seconds }}" 68 | 69 | # Check if an exit code was provided 70 | if [ -n "${{ inputs.success-exit-code }}" ]; then 71 | args+=" --success-exit-code=${{ inputs.success-exit-code }}" 72 | fi 73 | 74 | # Check for log directory/if a log file should be created 75 | if [ -n "${{ inputs.log-dir }}" ]; then 76 | args+=" --log-dir=${{ inputs.log-dir}}" 77 | fi 78 | 79 | # Check for retry attempts 80 | if [ -n "${{ inputs.retry-attempts }}" ]; then 81 | args+=" --retry-attempts=${{ inputs.retry-attempts }}" 82 | fi 83 | 84 | 85 | # set +e so if the run fails we can capture that and print custom error message 86 | set +e 87 | 88 | # Check for success line to search for 89 | if [ -n "${{ inputs.success-line }}" ]; then 90 | echo -e "${{ env.bashInfo }} Running: python3 ${args} --success-line=${{ inputs.success-line}} ${{ env.bashEnd }}" 91 | python3 ${args} --success-line="${{ inputs.success-line}}" 92 | else 93 | echo -e "${{ env.bashInfo }} Running: python3 ${args} ${{ env.bashEnd }}" 94 | python3 ${args} 95 | fi 96 | 97 | # Store status as the echo group will overwrite it 98 | exitStatus=$? 99 | set -e 100 | echo -e "::endgroup::" 101 | 102 | if [ $exitStatus -eq 0 ]; then 103 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 104 | else 105 | echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}" 106 | fi 107 | exit $exitStatus 108 | -------------------------------------------------------------------------------- /run_cbmc/action.yml: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: MIT-0 3 | # CBMC starter kit 2.9 4 | name: Run CBMC 5 | description: 'Action that runs the CBMC proofs inside of a FreeRTOS Repository' 6 | inputs: 7 | proofs_dir: 8 | required: true 9 | description: > 10 | The path to the cbmc/proofs directory, relative to the repository root 11 | and including `/proofs` at the end. 12 | run_cbmc_proofs_command: 13 | required: true 14 | default: ./run-cbmc-proofs.py 15 | description: > 16 | The path to a script that runs CBMC proofs by invoking Litani, relative 17 | to the proofs directory 18 | 19 | runs: 20 | using: composite 21 | steps: 22 | - env: 23 | bashPass: \033[32;1mPASSED - 24 | bashInfo: \033[33;1mINFO - 25 | bashFail: \033[31;1mFAILED - 26 | bashEnd: \033[0m 27 | stepName: Run CBMC 28 | name: ${{ env.stepName }} 29 | shell: bash 30 | working-directory: ${{ inputs.proofs_dir }} 31 | run: | 32 | # ${{ env.stepName }} 33 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 34 | ${{ inputs.run_cbmc_proofs_command }} 35 | echo -e "::endgroup::" 36 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 37 | 38 | - env: 39 | bashPass: \033[32;1mPASSED - 40 | bashInfo: \033[33;1mINFO - 41 | bashFail: \033[31;1mFAILED - 42 | bashEnd: \033[0m 43 | stepName: Check repository visibility 44 | name: ${{ env.stepName }} 45 | shell: bash 46 | run: | 47 | # ${{ env.stepName }} 48 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 49 | VIZ="${{ fromJson(toJson(github.event.repository)).visibility }}"; 50 | echo "REPO_VISIBILITY=${VIZ}" | tee -a "${GITHUB_ENV}"; 51 | 52 | - env: 53 | bashPass: \033[32;1mPASSED - 54 | bashInfo: \033[33;1mINFO - 55 | bashFail: \033[31;1mFAILED - 56 | bashEnd: \033[0m 57 | stepName: Set name for zip artifact with CBMC proof results 58 | name: ${{ env.stepName }} 59 | shell: bash 60 | id: artifact 61 | if: ${{ env.REPO_VISIBILITY == 'public' }} 62 | run: | 63 | # ${{ env.stepName }} 64 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 65 | echo "name=cbmc_proof_results_${{ fromJson(toJson(github.event.repository)).name }}_$(date +%Y_%m_%d_%H_%M_%S)" >> $GITHUB_OUTPUT 66 | echo -e "::endgroup::" 67 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 68 | 69 | - env: 70 | bashPass: \033[32;1mPASSED - 71 | bashInfo: \033[33;1mINFO - 72 | bashFail: \033[31;1mFAILED - 73 | bashEnd: \033[0m 74 | stepName: Create zip artifact with CBMC proof results 75 | name: ${{ env.stepName }} 76 | if: ${{ env.REPO_VISIBILITY == 'public' }} 77 | shell: bash 78 | run: | 79 | # ${{ env.stepName }} 80 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 81 | FINAL_REPORT_DIR="${{ inputs.proofs_dir }}/output/latest/html" 82 | pushd $FINAL_REPORT_DIR \ 83 | && zip -r ${{ steps.artifact.outputs.name }}.zip . \ 84 | && popd \ 85 | && mv $FINAL_REPORT_DIR/${{ steps.artifact.outputs.name }}.zip . 86 | echo -e "::endgroup::" 87 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 88 | 89 | - env: 90 | bashPass: \033[32;1mPASSED - 91 | bashInfo: \033[33;1mINFO - 92 | bashFail: \033[31;1mFAILED - 93 | bashEnd: \033[0m 94 | stepName: Upload zip artifact of CBMC proof results to GitHub Actions 95 | name: ${{ env.stepName }} 96 | if: ${{ env.REPO_VISIBILITY == 'public' }} 97 | uses: actions/upload-artifact@v4 98 | with: 99 | name: ${{ steps.artifact.outputs.name }} 100 | path: ${{ steps.artifact.outputs.name }}.zip 101 | 102 | - env: 103 | bashPass: \033[32;1mPASSED - 104 | bashInfo: \033[33;1mINFO - 105 | bashFail: \033[31;1mFAILED - 106 | bashEnd: \033[0m 107 | stepName: CBMC proof results 108 | name: ${{ env.stepName }} 109 | shell: bash 110 | run: | 111 | # ${{ env.stepName }} 112 | echo -e "${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 113 | python3 ${{ inputs.proofs_dir }}/lib/summarize.py \ 114 | --run-file ${{ inputs.proofs_dir }}/output/latest/html/run.json 115 | -------------------------------------------------------------------------------- /doxygen/generate_doxygen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import subprocess 3 | import sys 4 | import argparse 5 | import os 6 | import zipfile 7 | 8 | # Executes the passed command in a shell subprocess. 9 | # Returns True if any output is received from the shell process. 10 | def run_cmd(cmd): 11 | """ 12 | Execute the input command on the shell. 13 | """ 14 | print(f"Executing command: {cmd}") 15 | try: 16 | result = subprocess.run( 17 | cmd, 18 | stdout=subprocess.PIPE, 19 | stderr=subprocess.STDOUT, 20 | shell=True, 21 | encoding="utf-8", 22 | check=True, 23 | timeout=180, 24 | ) 25 | print( result.stdout ) 26 | return (len(result.stdout) > 0) 27 | except subprocess.CalledProcessError as e: 28 | result = e.stdout 29 | return result 30 | 31 | def get_lib_paths(root, lib_parent_dirs): 32 | """ 33 | Get all of the paths, relative to the root, to the libraries for which doxygen 34 | output has to be generated. 35 | """ 36 | abs_lib_paths = [] 37 | 38 | for lib_parent_dir in lib_parent_dirs: 39 | abs_lib_path_dir = os.path.join(root, lib_parent_dir) 40 | lib_path_dirs = os.listdir(abs_lib_path_dir) 41 | # Determine if it is a library path by checking if the directory contains "docs/doxygen" 42 | abs_lib_paths += [os.path.join(abs_lib_path_dir, dir) for dir in lib_path_dirs if os.path.exists(os.path.join(abs_lib_path_dir, dir, "docs", "doxygen"))] 43 | 44 | return abs_lib_paths 45 | 46 | 47 | def main(): 48 | """ 49 | Generate documentation and optionally zip it up. 50 | """ 51 | parser = argparse.ArgumentParser(description="Generate all doxygen and optionally zip it.") 52 | parser.add_argument("-r", "--root", action="store", required=False, dest="root", help="Repository root path. This defaults to the current working directory.") 53 | parser.add_argument("-d", "--library-directories", action="store", required=True, dest="lib_dirs", help="Comma-separate list of parent directories of libraries. These should be relative to repository root.") 54 | parser.add_argument("-z", "--zip", action="store_true", required=False, help="Zip all doxygen output.") 55 | args = parser.parse_args() 56 | repo_root = args.root 57 | doZip = args.zip 58 | 59 | # If the root folder is not give, use the current working directory. 60 | if( repo_root == None ): 61 | repo_root = os.getcwd() 62 | 63 | # Get the absolute paths to all of the libraries in the repository. 64 | abs_repo_root = os.path.abspath(repo_root) 65 | abs_lib_paths = get_lib_paths(abs_repo_root, args.lib_dirs.split(',')) 66 | abs_doxy_paths = [] 67 | doxygen_warnings_flag = False 68 | 69 | # Generate the doxygen for all of the libraries. 70 | for abs_lib_path in abs_lib_paths: 71 | abs_doxy_path = os.path.join(abs_lib_path, "docs", "doxygen") 72 | os.chdir(abs_lib_path) 73 | print(abs_lib_path) 74 | # If there is something printed by doxygen, then it represents a warning. 75 | doxygen_warnings_flag = run_cmd("doxygen docs/doxygen/config.doxyfile") or doxygen_warnings_flag 76 | abs_doxy_paths.append(abs_doxy_path) 77 | 78 | # Generate the doxygen for the repository to use the tags from the libraries. 79 | if os.path.exists(os.path.join(abs_repo_root,"docs","doxygen")): 80 | os.chdir(abs_repo_root) 81 | print(abs_repo_root) 82 | doxygen_warnings_flag = run_cmd("doxygen docs/doxygen/config.doxyfile") or doxygen_warnings_flag 83 | abs_doxy_paths.append(os.path.join(abs_repo_root, "docs", "doxygen")) 84 | 85 | # Zip up if desired. 86 | if not(doxygen_warnings_flag) and doZip: 87 | os.chdir(abs_repo_root) 88 | print(f"Zipping up to {abs_repo_root}{os.path.sep}doxygen.zip...") 89 | doxy_zip = zipfile.ZipFile("doxygen.zip", mode="w") 90 | try: 91 | for abs_doxy_path in abs_doxy_paths: 92 | abs_output_dir = os.path.join(abs_doxy_path, "output") 93 | for out_root, _, out_files in os.walk(abs_output_dir): 94 | rel_out_root = os.path.relpath(out_root, abs_repo_root) 95 | for out_file in out_files: 96 | doxy_zip.write(os.path.join(rel_out_root, out_file)) 97 | finally: 98 | doxy_zip.close() 99 | 100 | # Return failure exit code if doxygen generation resulted in warnings. 101 | if doxygen_warnings_flag == False: 102 | sys.exit(0) 103 | else: 104 | sys.exit(1) 105 | 106 | if __name__ == "__main__": 107 | main() 108 | -------------------------------------------------------------------------------- /spellings/action.yml: -------------------------------------------------------------------------------- 1 | name: 'spellings' 2 | description: 'cSpell CI spelling check' 3 | inputs: 4 | path: 5 | description: 'Path to repository folder to check spellings in.' 6 | required: false 7 | default: ./ 8 | exclude-dirs: 9 | description: "Comma separated list of directories to not spell check" 10 | required: false 11 | exclude-files: 12 | description: "Comma separated list of files to not spell check" 13 | required: false 14 | include-extensions: 15 | description: "Comma separated list of files to match to regex" 16 | required: false 17 | 18 | 19 | runs: 20 | using: "composite" 21 | steps: 22 | - env: 23 | bashPass: \033[32;1mPASSED - 24 | bashInfo: \033[33;1mINFO - 25 | bashFail: \033[31;1mFAILED - 26 | bashEnd: \033[0m 27 | stepName: Set-Up The Spell Checker 28 | name: ${{ env.stepName }} 29 | id: spell-checker-setup 30 | shell: bash 31 | run: | 32 | # ${{ env.stepName }} 33 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 34 | 35 | # Install the Dependencies we need to run the spell-checker 36 | sudo apt-get update -y 37 | sudo apt-get install util-linux -y 38 | sudo apt-get install fd-find -y 39 | sudo apt-get install npm -y 40 | sudo npm install -g cspell 41 | 42 | # Add the Github Action Path to PATH 43 | export PATH="$GITHUB_ACTION_PATH:$PATH" 44 | 45 | # Account for starting with an alternate path in a repository 46 | # Do this by copying the cspell config and wordlist to the desired path 47 | # Wrap in a set +e so Github doesn't throw an error if the file or 48 | # directory already exists. 49 | set +e 50 | cp cspell.config.yaml ${{ inputs.path }} 51 | mkdir ${{ inputs.path }}/.github 52 | cp .github/.cSpellWords.txt ${{ inputs.path }}/.github 53 | cd ${{ inputs.path }} 54 | set -e 55 | 56 | echo -e "::endgroup::" 57 | # Make sure we have all the commands we need. 58 | echo -e "${{ env.bashInfo }} fdfind --version $(fdfind --version) ${{ env.bashEnd }}" 59 | echo -e "${{ env.bashInfo }} cspell --version $(cspell --version) ${{ env.bashEnd }}" 60 | 61 | # Only reach this line if no errors were hit above 62 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 63 | 64 | - env: 65 | bashPass: \033[32;1mPASSED - 66 | bashInfo: \033[33;1mINFO - 67 | bashFail: \033[31;1mFAILED - 68 | bashEnd: \033[0m 69 | stepName: Spell Checker 70 | name: ${{ env.stepName }} 71 | id: run-spell-checker 72 | working-directory: ${{ inputs.path }} 73 | shell: bash 74 | run: | 75 | # ${{ env.stepName }} 76 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 77 | export PATH="$GITHUB_ACTION_PATH:$PATH" 78 | exitStatus=0 79 | 80 | # Parse the optional inputs 81 | args="" 82 | 83 | # fd-find uses -E to exclude a file or directory 84 | if [ -n "${{ inputs.exclude-dirs }}" ]; then 85 | dirs=" -E " 86 | dirs+="${{ inputs.exclude-dirs }}" 87 | dirs="${dirs//,/ -E }" 88 | args+=" ${dirs}" 89 | fi 90 | 91 | # fd-find uses -E to exclude a file or directory 92 | if [ -n "${{ inputs.exclude-files }}" ]; then 93 | files=" -E " 94 | files+="${{ inputs.exclude-files }}" 95 | files="${files//,/ -E }" 96 | args+=" ${files}" 97 | fi 98 | 99 | # fd-find uses -e to exclude a file extension 100 | if [ -n "${{ inputs.include-file-types }}" ]; then 101 | file_types=" -e " 102 | file_types+="${{ inputs.include-file-types }}" 103 | file_types="${file_types//,/ -e }" 104 | args+=" ${file_types}" 105 | fi 106 | 107 | echo -e "${{ env.bashInfo }} Running: fdfind -e c -e h -e md -e txt -e readme ${args} --exec-batch cspell lint --no-progress --language-id C --color --show-context --show-suggestions --no-must-find-files -c cspell.config.yaml ${{ env.bashEnd }}" 108 | 109 | # Wrap in a set +e so Github doesn't stop the spell check from running 110 | set +e 111 | 112 | # Find all relevant files, then check them for spelling mistakes 113 | fdfind -e c -e h -e md -e txt -e readme ${args} --exec-batch \ 114 | cspell lint --no-progress --language-id C --color --show-context --show-suggestions --no-must-find-files -c cspell.config.yaml 115 | exitStatus=$? 116 | set -e 117 | 118 | echo -e "::endgroup::" 119 | if [ $exitStatus -eq 0 ]; then 120 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 121 | else 122 | echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}" 123 | fi 124 | exit $exitStatus 125 | -------------------------------------------------------------------------------- /link-verifier/action.yml: -------------------------------------------------------------------------------- 1 | name: 'link-verifier' 2 | description: 'Verify links (URLs, anchors, and relative path hyperlinks)' 3 | inputs: 4 | path: 5 | description: 'Path to repository folder to run link verification on.' 6 | required: false 7 | default: ./ 8 | exclude-dirs: 9 | description: 'Comma-separated list of directory names to ignore. (Eg. cmock, cmbc)' 10 | required: false 11 | default: '' 12 | include-file-types: 13 | description: 'Comma-separated list of file type patters in repository to test. (Eg .c, .h)' 14 | required: false 15 | default: '.c, .h, .dox, .md, .html' 16 | allowlist-file: 17 | description: 'Path to file containing allowlist of URLs.' 18 | required: false 19 | default: '' 20 | exclude-urls: 21 | description: 'Comma separated list of URLS not to check' 22 | required: false 23 | default: https://www.misra.org.uk/misra-c, https://www.misra.org.uk 24 | user-agent: 25 | description: 'User agent string to use when making http requests.' 26 | required: false 27 | default: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36' 28 | runs: 29 | using: "composite" 30 | steps: 31 | - name: Setup Python for link verifier action 32 | uses: actions/setup-python@v5.1.0 33 | with: 34 | # Minimum version for urllib v2 (https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html) 35 | python-version: '>=3.7' 36 | 37 | - env: 38 | # The bash escape character is \033 39 | # At time of writing, you can't add a global environment 40 | # to an action file. If this gets changed please move this 41 | bashPass: \033[32;1mPASSED - 42 | bashInfo: \033[33;1mINFO - 43 | bashFail: \033[31;1mFAILED - 44 | bashEnd: \033[0m 45 | stepName: Install Dependencies 46 | name: ${{ env.stepName }} 47 | shell: bash 48 | run: | 49 | # ${{ env.stepName }} 50 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 51 | 52 | sudo apt update 53 | sudo apt install -y gh 54 | sudo apt install pandoc -y 55 | sudo apt-get install -y python3-setuptools python3-pip 56 | 57 | python3 -m pip install -r $GITHUB_ACTION_PATH/requirements.txt 58 | 59 | echo -e "::endgroup::" 60 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd}}" 61 | 62 | - env: 63 | bashPass: \033[32;1mPASSED - 64 | bashInfo: \033[33;1mINFO - 65 | bashFail: \033[31;1mFAILED - 66 | bashEnd: \033[0m 67 | stepName: Check Links in Files 68 | GITHUB_TOKEN: ${{ github.token }} 69 | name: ${{ env.stepName }} 70 | working-directory: ${{ inputs.path }} 71 | shell: bash 72 | run: | 73 | # ${{ env.stepName }} 74 | echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 75 | args="--test-markdown" 76 | if [ -n "${{ inputs.exclude-dirs }}" ]; then 77 | dirs="${{ inputs.exclude-dirs }}" 78 | dirs="${dirs//,/ }" 79 | args+=" --exclude-dirs ${dirs}" 80 | fi 81 | 82 | if [ -n "${{ inputs.include-file-types }}" ]; then 83 | file_types="${{ inputs.include-file-types }}" 84 | file_types="${file_types//,/ }" 85 | args+=" --include-file-types ${file_types}" 86 | fi 87 | 88 | # Many of the FreeRTOS-Repos include a link to MISRA's website. This website 89 | # now has a CAPTCHA landing page, as such always exclude it from this check. 90 | touch allowList.txt 91 | echo "https://www.misra.org.uk/misra-c" >> allowList.txt 92 | echo "https://www.misra.org.uk" >> allowList.txt 93 | 94 | if [ -n "${{ inputs.allowlist-file }}" ]; then 95 | cat ${{ inputs.allowlist-file }} >> allowList.txt 96 | fi 97 | 98 | if [[ "${{ inputs.exclude-urls }}" != "" ]]; then 99 | exclude_urls="${{ inputs.exclude-urls }}" 100 | exclude_urls="${exclude_urls//,/ }" 101 | for url in ${exclude_urls[@]}; do echo -e "$url" >> allowList.txt; done 102 | fi 103 | 104 | if [ -n "${{ inputs.allowlist-file }}" ] || [ -n "${{ inputs.exclude-urls }}" ]; then 105 | args+=" --allowlist-file allowList.txt" 106 | fi 107 | 108 | echo -e "${{ env.bashInfo }} Running: verify-links.py ${args} --user-agent \"${{ inputs.user-agent }}\" ${{ env.bashEnd }}" 109 | set +e 110 | python3 ${GITHUB_ACTION_PATH}/verify-links.py ${args} --user-agent "${{ inputs.user-agent }}"; 111 | exitStatus=$? 112 | set -e 113 | 114 | echo -e "::endgroup::" 115 | if [ $exitStatus -eq 1 ]; then 116 | echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}" 117 | else 118 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 119 | fi 120 | exit $exitStatus 121 | -------------------------------------------------------------------------------- /localhost-http-1.1-server/localhost_http_1.1_server.py: -------------------------------------------------------------------------------- 1 | from http.server import HTTPServer, BaseHTTPRequestHandler 2 | from socketserver import ThreadingMixIn 3 | from threading import Thread 4 | import socket 5 | import ssl 6 | from argparse import ArgumentParser 7 | 8 | LOCAL_HOST_IP = socket.gethostbyname("localhost") 9 | PLAINTEXT_PORT = 8080 10 | SSL_PORT = 4443 11 | 12 | # Define a threaded HTTP server class 13 | class ThreadedHTTPServer(ThreadingMixIn, HTTPServer): 14 | pass 15 | 16 | class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): 17 | protocol_version = 'HTTP/1.1' 18 | 19 | def do_GET(self): 20 | # Receive the body of the request - don't do anything with it, 21 | # but this needs to be done to clear the receiving buffer. 22 | if self.headers.get('Content-Length') is not None: 23 | recv_content_len = int(self.headers.get('Content-Length')) 24 | recv_body = self.rfile.read(recv_content_len) 25 | 26 | # Always send a 200 response with "Hello" in the body. 27 | response_body = "Hello".encode('utf-8') 28 | self.send_response(200) 29 | self.send_header("Content-Type", "text/plain") 30 | self.send_header("Content-Length", str(len(response_body))) 31 | self.end_headers() 32 | self.wfile.write(response_body) 33 | 34 | def do_PUT(self): 35 | # Receive the body of the request - don't do anything with it, 36 | # but this needs to be done to clear the receiving buffer. 37 | if self.headers.get('Content-Length') is not None: 38 | recv_content_len = int(self.headers.get('Content-Length')) 39 | recv_body = self.rfile.read(recv_content_len) 40 | 41 | # Always send a 200 response with "Hello" in the body. 42 | response_body = "Hello".encode('utf-8') 43 | self.send_response(200) 44 | self.send_header("Content-Type", "text/plain") 45 | self.send_header("Content-Length", str(len(response_body))) 46 | self.end_headers() 47 | self.wfile.write(response_body) 48 | 49 | def do_POST(self): 50 | # Receive the body of the request - don't do anything with it, 51 | # but this needs to be done to clear the receiving buffer. 52 | if self.headers.get('Content-Length') is not None: 53 | recv_content_len = int(self.headers.get('Content-Length')) 54 | recv_body = self.rfile.read(recv_content_len) 55 | 56 | # Always send a 200 response with "Hello" in the body. 57 | response_body = "Hello".encode('utf-8') 58 | self.send_response(200) 59 | self.send_header("Content-Type", "text/plain") 60 | self.send_header("Content-Length", str(len(response_body))) 61 | self.end_headers() 62 | self.wfile.write(response_body) 63 | 64 | def do_HEAD(self): 65 | # Receive the body of the request - don't do anything with it, 66 | # but this needs to be done to clear the receiving buffer. 67 | if self.headers.get('Content-Length') is not None: 68 | recv_content_len = int(self.headers.get('Content-Length')) 69 | recv_body = self.rfile.read(recv_content_len) 70 | 71 | # Always send a 200 response with same headers as GET but without 72 | # response body 73 | response_body = "Hello".encode('utf-8') 74 | self.send_response(200) 75 | self.send_header("Content-Type", "text/plain") 76 | self.send_header("Content-Length", str(len(response_body))) 77 | self.end_headers() 78 | 79 | if __name__ == '__main__': 80 | # Parse passed in credentials 81 | parser = ArgumentParser(description='Localhost MQTT broker.') 82 | 83 | parser.add_argument('--root-ca-cert-path', 84 | type=str, 85 | required=True, 86 | help='Path to the root CA certificate.') 87 | parser.add_argument('--server-cert-path', 88 | type=str, 89 | required=True, 90 | help='Path to the server certificate.') 91 | parser.add_argument('--server-priv-key-path', 92 | type=str, 93 | required=True, 94 | help='Path to the private key') 95 | args = parser.parse_args() 96 | 97 | # Create a plaintext HTTP server thread 98 | plaintext_http_server = ThreadedHTTPServer((LOCAL_HOST_IP, PLAINTEXT_PORT), SimpleHTTPRequestHandler) 99 | plaintext_http_server_thread = Thread(target=plaintext_http_server.serve_forever) 100 | plaintext_http_server_thread.start() 101 | 102 | # Create an SSL HTTP serve thread 103 | ssl_http_server = ThreadedHTTPServer((LOCAL_HOST_IP, SSL_PORT), SimpleHTTPRequestHandler) 104 | ssl_http_server.socket = ssl.wrap_socket(ssl_http_server.socket, keyfile=args.server_priv_key_path, certfile=args.server_cert_path, ca_certs=args.root_ca_cert_path, cert_reqs=ssl.CERT_OPTIONAL) 105 | ssl_http_server_thread = Thread(target=ssl_http_server.serve_forever) 106 | ssl_http_server_thread.start() 107 | 108 | plaintext_http_server_thread.join() 109 | ssl_http_server_thread.join() 110 | -------------------------------------------------------------------------------- /doxygen-generation/action.yml: -------------------------------------------------------------------------------- 1 | name: 'doxygen-generation' 2 | description: 'Generate doxygen documentation and push to gh-pages branch' 3 | inputs: 4 | ref: 5 | description: 'Reference (e.g. branch or tag) to the commit for generating doxygen' 6 | required: false 7 | default: 'main' 8 | add_release: 9 | description: 'Add ref to releases listed in the index page.' 10 | required: false 11 | default: "false" 12 | generate_command: 13 | description: 'Command to generate doxygen bundle.' 14 | required: false 15 | default: | 16 | doxygen docs/doxygen/config.doxyfile 2>&1 | tee doxyoutput.txt 17 | if [ "$(wc -c < doxyoutput.txt | bc)" = "0" ]; then exit 0; else exit 1; fi 18 | output_dir: 19 | description: 'Relative output directory of generate_command.' 20 | required: false 21 | default: docs/doxygen/output/html 22 | doxygen_link: 23 | description: 'Download link for doxygen tar.gz (default version 1.9.6).' 24 | required: false 25 | default: "https://sourceforge.net/projects/doxygen/files/rel-1.9.6/doxygen-1.9.6.linux.bin.tar.gz" 26 | doxygen_dependencies: 27 | description: 'Space-separated dependencies for doxygen.' 28 | required: false 29 | default: libclang-18-dev libclang-cpp18 graphviz 30 | 31 | runs: 32 | using: "composite" 33 | steps: 34 | - name: Checkout the repo for generating doxygen 35 | uses: actions/checkout@v4.1.1 36 | with: 37 | path: doxygen_source 38 | ref: ${{ inputs.ref }} 39 | 40 | - name: Install Doxygen 41 | shell: bash 42 | run: | 43 | wget -O "$HOME/doxygen.tgz" "${{ inputs.doxygen_link }}" 44 | if [ $? -ne 0 ]; then exit 1; fi 45 | 46 | EXPECTED_MD5="b6193a16bc5128597f5affd878dbd7b7" 47 | GENERATED_MD5=$(md5sum "$HOME/doxygen.tgz" | awk '{print $1}') 48 | 49 | if [ "$GENERATED_MD5" = "$EXPECTED_MD5" ]; then 50 | sudo tar --strip-components=1 -xzf "$HOME/doxygen.tgz" -C /usr/local 51 | sudo apt-get install -y ${{ inputs.doxygen_dependencies }} 52 | else 53 | echo -e "${{ env.bashFail }} MD5 checksum verification failed for doxygen.tgz ${{ env.bashEnd }}" 54 | echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}" 55 | exit -1 56 | fi 57 | 58 | - name: Generate doxygen 59 | working-directory: ./doxygen_source 60 | shell: bash 61 | run: ${{ inputs.generate_command }} 62 | 63 | - name: Checkout the repo for storing doxygen 64 | uses: actions/checkout@v4.1.1 65 | with: 66 | path: doxygen_store 67 | 68 | - name: Switch to gh-pages branch 69 | working-directory: ./doxygen_store 70 | shell: bash 71 | run: | 72 | # Check if the gh-pages branch exists. If not, create it. 73 | branch_exist=$(git ls-remote --heads origin gh-pages) 74 | if [ -z ${branch_exist} ]; then 75 | git config --global user.name ${{ github.actor }} 76 | git config --global user.email ${{ github.actor }}@users.noreply.github.com 77 | git checkout --orphan gh-pages 78 | git reset --hard 79 | git commit --allow-empty -m "Created gh-pages branch" 80 | git push origin gh-pages 81 | fi 82 | # Switch to gh-pages branch 83 | git fetch 84 | git checkout gh-pages 85 | 86 | - name: Replace previous doxygen documentation 87 | shell: bash 88 | run: | 89 | rm -rf doxygen_store/${{ inputs.ref }} 90 | mv doxygen_source/${{ inputs.output_dir }} doxygen_store/${{ inputs.ref }} 91 | 92 | - name: Update template files 93 | working-directory: ./doxygen_store/ 94 | shell: bash 95 | run: | 96 | cp -r $GITHUB_ACTION_PATH/template/* . 97 | 98 | - name: Ensure fields of doc_config.json exist 99 | working-directory: ./doxygen_store/ 100 | shell: bash 101 | run: | 102 | sudo apt-get install -y jq 103 | if [ ! -d "_data" ]; then 104 | mkdir _data 105 | echo "{}" > _data/doc_config.json 106 | fi 107 | doc_title=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}') 108 | jq '.name//="'$doc_title'"' _data/doc_config.json | 109 | jq '.releases//=[]' | 110 | jq '.branches//=["main"]' > tmp.json 111 | mv tmp.json _data/doc_config.json 112 | 113 | - name: Add to release list and update latest 114 | if: inputs.add_release != 'false' 115 | working-directory: ./doxygen_store/ 116 | shell: bash 117 | run: | 118 | jq '.releases|=if index("${{ inputs.ref }}") then . else ["${{ inputs.ref }}"]+. end' _data/doc_config.json > tmp.json 119 | mv tmp.json _data/doc_config.json 120 | rm -rf latest 121 | mkdir latest 122 | cp -r "${{ inputs.ref }}"/* latest 123 | 124 | - name: Commit new doxygen 125 | working-directory: ./doxygen_store 126 | shell: bash 127 | run: | 128 | git config --global user.name ${{ github.actor }} 129 | git config --global user.email ${{ github.actor }}@users.noreply.github.com 130 | commit_id=$(git rev-parse ${{ inputs.ref }}) 131 | git add . 132 | # Only commit if doxygen is changed. 133 | changed=$(git diff-index HEAD) 134 | if [ -n "$changed" ]; then 135 | git commit -m "Doxygen for ${commit_id}" 136 | git push origin gh-pages 137 | fi -------------------------------------------------------------------------------- /link-verifier/trusted_certs/ca_bundle.crt: -------------------------------------------------------------------------------- 1 | /*********** CA Chain start for wiki.segger.com. *************/ 2 | 3 | -----BEGIN CERTIFICATE----- 4 | MIIG8jCCBdqgAwIBAgIQCPqs+TwfXV3zHQ30fcn1STANBgkqhkiG9w0BAQsFADBZ 5 | MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMTMwMQYDVQQDEypE 6 | aWdpQ2VydCBHbG9iYWwgRzIgVExTIFJTQSBTSEEyNTYgMjAyMCBDQTEwHhcNMjMx 7 | MDIzMDAwMDAwWhcNMjQxMTIyMjM1OTU5WjCBgzELMAkGA1UEBhMCREUxHDAaBgNV 8 | BAgTE05vcmRyaGVpbi1XZXN0ZmFsZW4xGTAXBgNVBAcTEE1vbmhlaW0gYW0gUmhl 9 | aW4xJDAiBgNVBAoTG1NFR0dFUiBNaWNyb2NvbnRyb2xsZXIgR21iSDEVMBMGA1UE 10 | AwwMKi5zZWdnZXIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA 11 | nlSFUuIbuJFHO6DpHz/Bh1+dz+qiD4VZ4GpLSK1tkhptYPh+ZYx5pkMgqI34HehN 12 | 4wxt5pFIS58z5kkh/zE+fr9CwGCdWxkdPiANxwWQp13Ko27o7uZHo//2rBtQTjms 13 | rYlLHIURVlE89B6SJooEofTV2J/U61b9YGEea1PbwO2g9XoglJH8wDWX0WxqAcbG 14 | 3chOr8f0O66wRv0CCpp9B1hXc6DcvhSSD/xGa32hnwHN55LhmivmOQtt2MWYzrpa 15 | 5hMN3RSh1jkH2M7dhMgFLLyu4j96yjOOHkfXDKyxTWPQLJ5QKLfFHs4x/syvcMxW 16 | akbZuZHeZQoVN8kb1ZWRCQIDAQABo4IDiTCCA4UwHwYDVR0jBBgwFoAUdIWAwGbH 17 | 3zfez70pN6oDHb7tzRcwHQYDVR0OBBYEFMd+XguAicKsxhuJFDNGzIvjYeu7MBcG 18 | A1UdEQQQMA6CDCouc2VnZ2VyLmNvbTA+BgNVHSAENzA1MDMGBmeBDAECAjApMCcG 19 | CCsGAQUFBwIBFhtodHRwOi8vd3d3LmRpZ2ljZXJ0LmNvbS9DUFMwDgYDVR0PAQH/ 20 | BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjCBnwYDVR0fBIGX 21 | MIGUMEigRqBEhkJodHRwOi8vY3JsMy5kaWdpY2VydC5jb20vRGlnaUNlcnRHbG9i 22 | YWxHMlRMU1JTQVNIQTI1NjIwMjBDQTEtMS5jcmwwSKBGoESGQmh0dHA6Ly9jcmw0 23 | LmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEdsb2JhbEcyVExTUlNBU0hBMjU2MjAyMENB 24 | MS0xLmNybDCBhwYIKwYBBQUHAQEEezB5MCQGCCsGAQUFBzABhhhodHRwOi8vb2Nz 25 | cC5kaWdpY2VydC5jb20wUQYIKwYBBQUHMAKGRWh0dHA6Ly9jYWNlcnRzLmRpZ2lj 26 | ZXJ0LmNvbS9EaWdpQ2VydEdsb2JhbEcyVExTUlNBU0hBMjU2MjAyMENBMS0xLmNy 27 | dDAMBgNVHRMBAf8EAjAAMIIBfwYKKwYBBAHWeQIEAgSCAW8EggFrAWkAdwDuzdBk 28 | 1dsazsVct520zROiModGfLzs3sNRSFlGcR+1mwAAAYtbLd3lAAAEAwBIMEYCIQCP 29 | c6RveylhvzBaOFg0Lb9SzPlsl2qJRBy1gtPxeT/p0gIhALdEFiUsDmmlkSopD9tA 30 | lcys+MZOC4EAJbSd3Gqjy8jiAHYASLDja9qmRzQP5WoC+p0w6xxSActW3SyB2bu/ 31 | qznYhHMAAAGLWy3d+wAABAMARzBFAiEAzz0HR+9Ub6OQY2yeqiCQdpHjZvCKS0r1 32 | DHEgvpSO1sQCIGwuAeCRYd7MRyxrnRpKP4W4KYEk81GBUhY/U/FMMekCAHYA2ra/ 33 | az+1tiKfm8K7XGvocJFxbLtRhIU0vaQ9MEjX+6sAAAGLWy3d6gAABAMARzBFAiAF 34 | W8keKo/nJlK6SpPgNsNNHTqeHYGTw2B4GcGo3M4f7AIhAPLPloOcSfnZH8tvcEyV 35 | EuQWifNaRCLt6nHTtbRel+F8MA0GCSqGSIb3DQEBCwUAA4IBAQBbzc037fmC4z8F 36 | KKNYM7jLj/nKvz+8ygnVpxUcQKPQx5hS/i+k2j+oQIv/YR7IrPJMkBKnNLgV8a6y 37 | S4LWmwFa4sw2Ff2K4QSH+evxH166CfphhOlVmB3Bv8aauo9RFB1J1bNuhRGO8ySA 38 | kvL4gXqiDTS2VVHctIYiPX9rfjwyfsuhmGIwsi16ZyJ04zXDDFNwbMTacACJiK/u 39 | 0AP4LJC0Bh7n+3ETGH1PoaOkr5cmQaI9tKhYSZdiEMnLxI7KIaNApFnfCqdd+EQT 40 | LCKZbBSQ4GGHexntbu4KenLPwZ2sSjuwDlSNB2yGFLej3gV0leOKZ/zDsKcVplJ+ 41 | mDWCvLnn 42 | -----END CERTIFICATE----- 43 | -----BEGIN CERTIFICATE----- 44 | MIIEyDCCA7CgAwIBAgIQDPW9BitWAvR6uFAsI8zwZjANBgkqhkiG9w0BAQsFADBh 45 | MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 46 | d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH 47 | MjAeFw0yMTAzMzAwMDAwMDBaFw0zMTAzMjkyMzU5NTlaMFkxCzAJBgNVBAYTAlVT 48 | MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxMzAxBgNVBAMTKkRpZ2lDZXJ0IEdsb2Jh 49 | bCBHMiBUTFMgUlNBIFNIQTI1NiAyMDIwIENBMTCCASIwDQYJKoZIhvcNAQEBBQAD 50 | ggEPADCCAQoCggEBAMz3EGJPprtjb+2QUlbFbSd7ehJWivH0+dbn4Y+9lavyYEEV 51 | cNsSAPonCrVXOFt9slGTcZUOakGUWzUb+nv6u8W+JDD+Vu/E832X4xT1FE3LpxDy 52 | FuqrIvAxIhFhaZAmunjZlx/jfWardUSVc8is/+9dCopZQ+GssjoP80j812s3wWPc 53 | 3kbW20X+fSP9kOhRBx5Ro1/tSUZUfyyIxfQTnJcVPAPooTncaQwywa8WV0yUR0J8 54 | osicfebUTVSvQpmowQTCd5zWSOTOEeAqgJnwQ3DPP3Zr0UxJqyRewg2C/Uaoq2yT 55 | zGJSQnWS+Jr6Xl6ysGHlHx+5fwmY6D36g39HaaECAwEAAaOCAYIwggF+MBIGA1Ud 56 | EwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFHSFgMBmx9833s+9KTeqAx2+7c0XMB8G 57 | A1UdIwQYMBaAFE4iVCAYlebjbuYP+vq5Eu0GF485MA4GA1UdDwEB/wQEAwIBhjAd 58 | BgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwdgYIKwYBBQUHAQEEajBoMCQG 59 | CCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdpY2VydC5jb20wQAYIKwYBBQUHMAKG 60 | NGh0dHA6Ly9jYWNlcnRzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEdsb2JhbFJvb3RH 61 | Mi5jcnQwQgYDVR0fBDswOTA3oDWgM4YxaHR0cDovL2NybDMuZGlnaWNlcnQuY29t 62 | L0RpZ2lDZXJ0R2xvYmFsUm9vdEcyLmNybDA9BgNVHSAENjA0MAsGCWCGSAGG/WwC 63 | ATAHBgVngQwBATAIBgZngQwBAgEwCAYGZ4EMAQICMAgGBmeBDAECAzANBgkqhkiG 64 | 9w0BAQsFAAOCAQEAkPFwyyiXaZd8dP3A+iZ7U6utzWX9upwGnIrXWkOH7U1MVl+t 65 | wcW1BSAuWdH/SvWgKtiwla3JLko716f2b4gp/DA/JIS7w7d7kwcsr4drdjPtAFVS 66 | slme5LnQ89/nD/7d+MS5EHKBCQRfz5eeLjJ1js+aWNJXMX43AYGyZm0pGrFmCW3R 67 | bpD0ufovARTFXFZkAdl9h6g4U5+LXUZtXMYnhIHUfoyMo5tS58aI7Dd8KvvwVVo4 68 | chDYABPPTHPbqjc1qCmBaZx2vN4Ye5DUys/vZwP9BFohFrH/6j/f3IL16/RZkiMN 69 | JCqVJUzKoZHm1Lesh3Sz8W2jmdv51b2EQJ8HmA== 70 | -----END CERTIFICATE----- 71 | -----BEGIN CERTIFICATE----- 72 | MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh 73 | MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 74 | d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH 75 | MjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVT 76 | MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j 77 | b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkqhkiG 78 | 9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI 79 | 2/Ou8jqJkTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx 80 | 1x7e/dfgy5SDN67sH0NO3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQ 81 | q2EGnI/yuum06ZIya7XzV+hdG82MHauVBJVJ8zUtluNJbd134/tJS7SsVQepj5Wz 82 | tCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyMUNGPHgm+F6HmIcr9g+UQ 83 | vIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQABo0IwQDAP 84 | BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV 85 | 5uNu5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY 86 | 1Yl9PMWLSn/pvtsrF9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4 87 | NeF22d+mQrvHRAiGfzZ0JFrabA0UWTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NG 88 | Fdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBHQRFXGU7Aj64GxJUTFy8bJZ91 89 | 8rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe 90 | pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl 91 | MrY= 92 | -----END CERTIFICATE----- 93 | 94 | /************ CA Chain end for wiki.segger.com. ***************/ 95 | -------------------------------------------------------------------------------- /rust-spell-check/action.yml: -------------------------------------------------------------------------------- 1 | name: 'rust-spell-check' 2 | description: 'Rust CI spelling check' 3 | inputs: 4 | path: 5 | description: 'Path to repository folder to check spellings in.' 6 | required: false 7 | default: ./ 8 | exclude-dirs: 9 | description: "Comma separated list of directories to not spell check" 10 | required: false 11 | exclude-files: 12 | description: "Comma separated list of files to not spell check" 13 | required: false 14 | include-extensions: 15 | description: "Comma separated list of files to match to regex" 16 | required: false 17 | 18 | 19 | runs: 20 | using: "composite" 21 | steps: 22 | - env: 23 | bashPass: \033[32;1mPASSED - 24 | bashInfo: \033[33;1mINFO - 25 | bashFail: \033[31;1mFAILED - 26 | bashEnd: \033[0m 27 | stepName: Set-Up The Spell Checker 28 | name: ${{ env.stepName }} 29 | id: spell-checker-setup 30 | shell: bash 31 | run: | 32 | # ${{ env.stepName }} 33 | echo -e "::group::Install Dependencies" 34 | 35 | # Install the Dependencies we need to run the spell-checker 36 | sudo apt-get install util-linux -y 37 | sudo apt-get install fd-find -y 38 | sudo apt-get install aspell -y 39 | sudo apt-get install spell -y 40 | echo -e "::endgroup::" 41 | 42 | # Add the current directory to PATH 43 | export PATH="$GITHUB_ACTION_PATH:$PATH" 44 | 45 | # Due to feedback from @archigup we will not be storing the binary 46 | # So will build it from scratch each time. A future improvement is to use 47 | # GitHub Caches or a public S3 bucket to store a pre-built one and download it. 48 | # When this is done this logic below needs to be changed to perform the download 49 | # And then try to use the spell-checker. Leaving this here for future reference 50 | # When this work is being done. 51 | # echo -e " ${{ env.bashInfo }} Try Using the pre-built spell checker ${{ env.bashEnd }}" 52 | # Wrap the check to use if in a set +e so we don't error out if it fails 53 | # Save the exit code to check later, as "set -e" will overwrite it 54 | # set +e 55 | # spell-checker 56 | # exitCode=$? 57 | # set -e 58 | 59 | echo -e "::group::Compile Spell Checker" 60 | exitCode=1 61 | 62 | if ! [ $exitCode -eq 0 ]; then 63 | #echo -e " ${{ env.bashFail }} Don't have the ability to use the current spell checker, building it ${{ env.bashEnd }}" 64 | 65 | # If we can't run the current one, install the tools we need to build it 66 | # Run one a time for error checking 67 | sudo apt-get install libaspell-dev -y 68 | sudo apt-get install build-essential -y 69 | sudo apt install rustc -y 70 | 71 | echo -e "${{ env.bashInfo }} cargo --version = $(cargo --version) ${{ env.bashEnd }}" 72 | echo -e "${{ env.bashInfo }} rustc --version = $(rustc --version) ${{ env.bashEnd }}" 73 | 74 | pushd "$GITHUB_ACTION_PATH" 75 | cargo build --release 76 | echo -e "find = $(find . -name 'spell-checker') " 77 | # It's possible that we have one in the directory, but just can't suse it 78 | # set +e so we don't error when overriding it 79 | set +e 80 | mv $(find . -name "spell-checker") . 81 | set -e 82 | popd 83 | spell-checker --help 84 | echo -e "::endgroup::Compile Spell Checker" 85 | 86 | # Only make it to here if nothing above fails 87 | echo -e "${{ env.bashPass }} Compiled the Spell Checker ${{ env.bashEnd }}" 88 | fi 89 | echo -e "::endgroup::" 90 | 91 | # Only get to here if nothing above fails 92 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 93 | 94 | - env: 95 | bashPass: \033[32;1mPASSED - 96 | bashInfo: \033[33;1mINFO - 97 | bashFail: \033[31;1mFAILED - 98 | bashEnd: \033[0m 99 | stepName: Spell Checker 100 | name: ${{ env.stepName }} 101 | id: run-spell-checker 102 | working-directory: ${{ inputs.path }} 103 | shell: bash 104 | run: | 105 | # ${{ env.stepName }} 106 | #echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" 107 | export PATH="$GITHUB_ACTION_PATH:$PATH" 108 | 109 | # So here's the deal. At time of writing this spell checker can check 110 | # every word in every folder in FreeRTOS/FreeRTOS in like 10 seconds. 111 | # So I just let it do that. If this changes in the future, feel free to use 112 | # The various exclude dir/file options 113 | # files=$(getFiles --exclude-dirs="${{ inputs.exclude-dirs}}" --exclude-files="${{ inputs.exclude-files }}" --include-extensions="${{ inputs.include-extensions }}") 114 | 115 | # The use of exec will return the exit code from the grep command 116 | # Grep returns an exit code if a file isn't found 117 | # So wrap the search in a set +/- e so github doesn't stop the run on first failure 118 | set +e 119 | files=$(fdfind -e c -e h --exec grep -liE "copyright (.*) [0-9]{4} amazon.com") 120 | set -e 121 | 122 | # If you're onboarding a repo or need better debugging, uncomment this instead 123 | # Of the one-line check 124 | # for file in ${files[@]}; do 125 | # echo -e "${{ env.bashInfo }} Checking spelling of "$file" ${{ env.bashEnd }}" 126 | # set +e 127 | # spell-checker -c -w .cSpellWords.txt $file 128 | # exitStatus=$? 129 | # set -e 130 | # done 131 | 132 | # Wrap in set +e so the first mis-spelled word doesn't end the run 133 | set +e 134 | spell-checker -c -w .github/.cSpellWords.txt $files 135 | exitStatus=$? 136 | set -e 137 | 138 | echo -e "::endgroup::" 139 | if [ $exitStatus -eq 0 ]; then 140 | echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" 141 | else 142 | echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}" 143 | exit 1 144 | fi 145 | --------------------------------------------------------------------------------