File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
2+ # Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
3+ name : corpus
4+
5+ on :
6+ schedule :
7+ - cron : ' 0 0 * * 0'
8+ workflow_dispatch :
9+
10+ permissions :
11+ contents : read
12+
13+ jobs :
14+ corpus :
15+ runs-on : ubuntu-22.04
16+ if : ${{ github.repository_owner == 'danmar' }}
17+
18+ steps :
19+ - uses : actions/checkout@v4
20+ with :
21+ persist-credentials : false
22+
23+ - name : ccache
24+ uses : hendrikmuhs/ccache-action@v1.2
25+ with :
26+ key : ${{ github.workflow }}-${{ runner.os }}
27+
28+ - name : Install missing software on ubuntu
29+ run : |
30+ sudo apt-get update
31+ sudo apt-get install -y fdupes
32+
33+ - name : build testrunner
34+ run : |
35+ store_dir=$(pwd)/store
36+ mkdir $store_dir
37+ export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
38+ make -s -j$(nproc) CXXFLAGS="-w -DSTORE_INPUT_DIR=\"\\\"$store_dir\\\"\"" testrunner
39+
40+ - name : run testrunner
41+ run : |
42+ ./testrunner -q
43+
44+ - name : de-duplicate files
45+ run : |
46+ ls -l ./store | wc -l
47+ echo "removing duplicates"
48+ fdupes -qdN ./store > /dev/null
49+ ls -l ./store | wc -l
50+ # print biggest size
51+ ls -l ./store | cut -d' ' -f5 | sort -u -n -r | head -n1
52+
53+ # TODO: dedup with fuzzer?
54+
55+ - uses : actions/upload-artifact@v4
56+ if : success()
57+ with :
58+ name : corpus
59+ path : ./store
Original file line number Diff line number Diff line change @@ -328,8 +328,30 @@ bool TokenList::createTokens(std::istream &code)
328328
329329// ---------------------------------------------------------------------------
330330
331+ #ifdef STORE_INPUT_DIR
332+ #include < atomic>
333+ #include < fstream>
334+ #include < sstream>
335+
336+ static void storeInput (std::istream &code)
337+ {
338+ static std::atomic_uint64_t num (0 );
339+ {
340+ std::ostringstream oss;
341+ oss << code.rdbuf ();
342+ code.seekg (0 );
343+ std::ofstream out (STORE_INPUT_DIR " /" + std::to_string (num++));
344+ out << oss.str ();
345+ }
346+ }
347+ #endif
348+
331349bool TokenList::createTokensInternal (std::istream &code, const std::string& file0)
332350{
351+ #ifdef STORE_INPUT_DIR
352+ storeInput (code);
353+ #endif
354+
333355 simplecpp::OutputList outputList;
334356 simplecpp::TokenList tokens (code, mFiles , file0, &outputList);
335357
You can’t perform that action at this time.
0 commit comments