<commit_before>#!/bin/sh

# Travis CI uses this script to build an submit code coverage results.

# Exit on any nonzero return code.
set -e

# Set Thing Name.
AWS_IOT_THING_NAME="$AWS_IOT_THING_NAME_PREFIX$CC"

# Delete everything in the build directory.
mkdir -p build
cd build
rm -rf *

# Build tests and demos against AWS IoT with gcov.
cmake .. -DIOT_BUILD_TESTS=1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-DIOT_TEST_SERVER=\"\\\"$AWS_IOT_ENDPOINT\\\"\" -DIOT_TEST_PORT=443 -DIOT_TEST_ROOT_CA=\"\\\"../credentials/AmazonRootCA1.pem\\\"\" -DIOT_TEST_CLIENT_CERT=\"\\\"../credentials/clientCert.pem\\\"\" -DIOT_TEST_PRIVATE_KEY=\"\\\"../credentials/privateKey.pem\\\"\" -DIOT_TEST_MQTT_CLIENT_IDENTIFIER=\"\\\"$AWS_IOT_THING_NAME\\\"\" -DAWS_IOT_TEST_SHADOW_THING_NAME=\"\\\"$AWS_IOT_THING_NAME\\\"\" -DIOT_TEST_MQTT_TOPIC_PREFIX=\"\\\"$AWS_IOT_THING_NAME\\\"\" -DIOT_LOG_LEVEL_GLOBAL=IOT_LOG_DEBUG -DIOT_DEMO_MQTT_TOPIC_PREFIX=\"\\\"$AWS_IOT_THING_NAME\\\"\" -DIOT_TEST_COVERAGE=1 --coverage"
make

# Run MQTT tests and demo against AWS IoT with code coverage.
./bin/iot_tests_mqtt 2&> /dev/null
./bin/iot_demo_mqtt -h "$AWS_IOT_ENDPOINT" -p 443 -s -r ../credentials/AmazonRootCA1.pem -c ../credentials/clientCert.pem -k ../credentials/privateKey.pem -i "$AWS_IOT_THING_NAME" 2&> /dev/null

# Run Shadow tests and demo with code coverage.
./bin/aws_iot_tests_shadow 2&> /dev/null
./bin/aws_iot_demo_shadow -h "$AWS_IOT_ENDPOINT" -p 443 -s -r ../credentials/AmazonRootCA1.pem -c ../credentials/clientCert.pem -k ../credentials/privateKey.pem -i "$AWS_IOT_THING_NAME" 2&> /dev/null

# Generate code coverage results, excluding Unity test framework, demo files, and tests files.
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '*unity*' --output-file coverage.info
lcov --remove coverage.info '*demo*' --output-file coverage.info
lcov --remove coverage.info '*tests*' --output-file coverage.info

# Submit the code coverage results.
cd ..
coveralls --lcov-file build/coverage.info<commit_msg>Add common tests (lists, taskpool, ...) and defender to code coverage run. (#308)<commit_after>#!/bin/sh

# Travis CI uses this script to build an submit code coverage results.

# Exit on any nonzero return code.
set -e

# Set Thing Name.
AWS_IOT_THING_NAME="$AWS_IOT_THING_NAME_PREFIX$CC"

# Delete everything in the build directory.
mkdir -p build
cd build
rm -rf *

# Build tests and demos against AWS IoT with gcov.
cmake .. -DIOT_BUILD_TESTS=1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-DIOT_TEST_SERVER=\"\\\"$AWS_IOT_ENDPOINT\\\"\" -DIOT_TEST_PORT=443 -DIOT_TEST_ROOT_CA=\"\\\"../credentials/AmazonRootCA1.pem\\\"\" -DIOT_TEST_CLIENT_CERT=\"\\\"../credentials/clientCert.pem\\\"\" -DIOT_TEST_PRIVATE_KEY=\"\\\"../credentials/privateKey.pem\\\"\" -DIOT_TEST_MQTT_CLIENT_IDENTIFIER=\"\\\"$AWS_IOT_THING_NAME\\\"\" -DAWS_IOT_TEST_SHADOW_THING_NAME=\"\\\"$AWS_IOT_THING_NAME\\\"\" -DIOT_TEST_MQTT_TOPIC_PREFIX=\"\\\"$AWS_IOT_THING_NAME\\\"\" -DIOT_LOG_LEVEL_GLOBAL=IOT_LOG_DEBUG -DIOT_DEMO_MQTT_TOPIC_PREFIX=\"\\\"$AWS_IOT_THING_NAME\\\"\" -DIOT_TEST_COVERAGE=1 --coverage"
make

# Run Common tests with code coverage.
./bin/iot_tests_mqtt 2&> /dev/null

# Run MQTT tests and demo against AWS IoT with code coverage.
./bin/iot_tests_mqtt 2&> /dev/null
./bin/iot_demo_mqtt -h "$AWS_IOT_ENDPOINT" -p 443 -s -r ../credentials/AmazonRootCA1.pem -c ../credentials/clientCert.pem -k ../credentials/privateKey.pem -i "$AWS_IOT_THING_NAME" 2&> /dev/null

# Run Shadow tests and demo with code coverage.
./bin/aws_iot_tests_shadow 2&> /dev/null
./bin/aws_iot_demo_shadow -h "$AWS_IOT_ENDPOINT" -p 443 -s -r ../credentials/AmazonRootCA1.pem -c ../credentials/clientCert.pem -k ../credentials/privateKey.pem -i "$AWS_IOT_THING_NAME" 2&> /dev/null

# Run Defender tests with code coverage.
./bin/aws_iot_tests_defender 2&> /dev/null

# Generate code coverage results, excluding Unity test framework, demo files, and tests files.
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '*unity*' --output-file coverage.info
lcov --remove coverage.info '*demo*' --output-file coverage.info
lcov --remove coverage.info '*tests*' --output-file coverage.info

# Submit the code coverage results.
cd ..
coveralls --lcov-file build/coverage.info
{'fraction_non_alphanumeric': 0.15601679104477612, 'fraction_numerical': 0.009561567164179104, 'mean_word_length': 4.063754427390791, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1313901', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1602, 'n_words': 358}