Skip to content

Commit 7e4e3df

Browse files
committed
lcms: Support lcms
1 parent a84f76a commit 7e4e3df

File tree

5 files changed

+118
-1
lines changed

5 files changed

+118
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Benchmark
7171
- [x] libaom
7272
- [x] zlib
7373
- [x] c-ares
74-
- [ ] lcms
74+
- [x] lcms
7575

7676
### Fuzz-driver generation loop
7777

benchmark/lcms/_sanity.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include "lcms2.h"
2+
#include <stdio.h>
3+
4+
int main() {
5+
cmsPipeline* AToB0 = cmsPipelineAlloc(0, 3, 3);
6+
cmsPipelineFree(AToB0);
7+
return 0;
8+
}

benchmark/lcms/_sanity.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
clang _sanity.c \
2+
./workspace/lib/liblcms2.so \
3+
-I ./workspace/include \
4+
-g \
5+
-fno-omit-frame-pointer \
6+
-fsanitize=address,undefined \
7+
-fsanitize-address-use-after-scope \
8+
-fprofile-instr-generate \
9+
-fcoverage-mapping
10+
11+
LD_PRELOAD=./workspace/lib/liblcms2.so ./a.out
12+
13+
llvm-profdata merge -sparse default.profraw -o default.profdata
14+
llvm-cov export ./workspace/lib/liblcms2.so -format=lcov --instr-profile=default.profdata | grep cmsPipelineAlloc
15+
# llvm-cov export ./a.out -format=lcov --instr-profile=default.profdata | grep ares_library_init

benchmark/lcms/build.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
3+
if [ -z $WORKDIR ]; then
4+
WORKDIR=./workspace
5+
fi
6+
# | workspace
7+
# | src (required)
8+
# | Little-CMS (repo)
9+
# | build
10+
# | lib (required)
11+
# | liblcms2.so
12+
# | include (optional)
13+
# | lcms2.h
14+
# | lcms2_plugin.h
15+
# | corpus (optional)
16+
# | new.icc
17+
# | ....
18+
# | dict (optional)
19+
# | icc.dict
20+
21+
mkdir -p $WORKDIR
22+
# to absolute path
23+
WORKDIR=`realpath $WORKDIR`
24+
pushd $WORKDIR
25+
26+
SRCDIR=$WORKDIR/src
27+
mkdir -p $SRCDIR && pushd $SRCDIR
28+
# clone the project
29+
git clone https://github.com/mm2/Little-CMS
30+
# specify the version
31+
pushd Little-CMS
32+
git checkout lcms2.16
33+
34+
BUILDIR=$WORKDIR/build
35+
mkdir -p $BUILDIR && pushd $BUILDIR
36+
# build
37+
FLAGS="-g -fprofile-instr-generate -fcoverage-mapping"
38+
export CC=clang
39+
export CXX=clang++
40+
export CFLAGS="$CFLAGS $FLAGS"
41+
export CXXFLAGS="$CXXFLAGS $FLAGS"
42+
# prepare install directory
43+
mkdir install
44+
# build
45+
$SRCDIR/Little-CMS/autogen.sh \
46+
--srcdir=$SRCDIR/Little-CMS \
47+
--prefix=`realpath ./install`
48+
49+
make -j 4
50+
make install
51+
52+
# copy library
53+
mkdir -p $WORKDIR/lib
54+
cp ./install/lib/liblcms2.so $WORKDIR/lib
55+
56+
# copy header files
57+
mkdir -p $WORKDIR/include
58+
cp ./install/include/*.h $WORKDIR/include/
59+
60+
# $SRCDIR/Little-CMS
61+
popd
62+
63+
# copy corpus
64+
mkdir -p $WORKDIR/corpus
65+
cp ./testbed/*.icc $WORKDIR/corpus
66+
# $SRCDIR
67+
popd
68+
69+
# download dict
70+
mkdir -p $WORKDIR/dict
71+
pushd $WORKDIR/dict
72+
wget https://raw.githubusercontent.com/AFLplusplus/AFLplusplus/refs/heads/stable/dictionaries/icc.dict
73+
# $SRCDIR
74+
popd
75+
76+
# $WORKDIR
77+
popd
78+
79+
popd

benchmark/lcms/config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Config
2+
name: lcms
3+
srcdir: ./workspace/src/Little-CMS
4+
postfix:
5+
- .h
6+
- .hpp
7+
- .hxx
8+
fuzzdict: ./workspace/dict/icc.dict
9+
corpus_dir: ./workspace/corpus
10+
# CppConfig
11+
libpath: ./workspace/lib/liblcms2.so
12+
include_dir:
13+
- ./workspace/include
14+
timeout: 60
15+
timeout_unit: 10

0 commit comments

Comments
 (0)