Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/corpus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
name: corpus

on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:

permissions:
contents: read

jobs:
corpus:
runs-on: ubuntu-22.04
if: ${{ github.repository_owner == 'cppcheck-opensource' }}

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ runner.os }}

- name: Install missing software on ubuntu
run: |
sudo apt-get update
sudo apt-get install -y fdupes

- name: build testrunner
run: |
store_dir=$(pwd)/store
mkdir $store_dir
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) CXXOPTS="-Werror" CPPOPTS="-DSTORE_INPUT_DIR=\"\\\"$store_dir\\\"\"" testrunner

- name: run testrunner
run: |
./testrunner -q

- name: de-duplicate files
run: |
set -x
ls -l ./store | wc -l
echo "removing duplicates"
fdupes -qdN ./store > /dev/null
ls -l ./store | wc -l
# print largest size
ls -l ./store | cut -d' ' -f5 | sort -u -n -r | head -n1

- uses: actions/upload-artifact@v4
if: success()
with:
name: corpus
path: ./store
18 changes: 18 additions & 0 deletions lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,26 @@

//---------------------------------------------------------------------------

#ifdef STORE_INPUT_DIR
#include <atomic>

Check warning

Code scanning / Cppcheck Premium

#include directives should only be preceded by preprocessor directives or comments Warning

#include directives should only be preceded by preprocessor directives or comments
Comment thread
danmar marked this conversation as resolved.
Dismissed
#include <fstream>

Check warning

Code scanning / Cppcheck Premium

#include directives should only be preceded by preprocessor directives or comments Warning

#include directives should only be preceded by preprocessor directives or comments

static void storeInput(const char* data, size_t size)
{
static std::atomic_uint64_t num(0);
{
std::ofstream out(STORE_INPUT_DIR "/" + std::to_string(num++));
out.write(data, size);
}
}
#endif

bool TokenList::createTokensFromBufferInternal(const char* data, size_t size, const std::string& file0)
{
#ifdef STORE_INPUT_DIR
storeInput(data, size);
#endif

simplecpp::OutputList outputList;
simplecpp::TokenList tokens({data, size}, mFiles, file0, &outputList);

Expand Down
Loading