Skip to content

Commit

Permalink
Merge pull request #441 from seoklab/fmt/fuzz
Browse files Browse the repository at this point in the history
test(fmt): add fuzz test and fix various bugs
  • Loading branch information
jnooree authored Dec 24, 2024
2 parents e009867 + 5a049f9 commit 0dd9030
Show file tree
Hide file tree
Showing 106 changed files with 1,912 additions and 46 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ repos:
- id: check-symlinks
- id: destroyed-symlinks
- id: end-of-file-fixer
exclude: ^test/test_data/
exclude: ^(test/test_data/|fuzz/corpus-min/)
- id: fix-byte-order-marker
exclude: ^test/test_data/
exclude: ^(test/test_data/|fuzz/corpus-min/)
- id: trailing-whitespace
exclude: ^test/test_data/
exclude: ^(test/test_data/|fuzz/corpus-min/)
args: ["--markdown-linebreak-ext=md"]
- id: mixed-line-ending
exclude: ^test/test_data/
exclude: ^(test/test_data/|fuzz/corpus-min/)
args: ["--fix=lf"]
- repo: https://github.com/seoklab/shared-hooks
rev: v0.1.4
Expand Down
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ if(NURI_BUILD_FUZZING)
message(FATAL_ERROR "Fuzzing build is only supported with Clang")
endif()

message("Fuzzing build: enabling sanitizers")
message("Fuzzing build: enabling sanitizers and sanitizer coverage")
set(NURI_ENABLE_SANITIZERS ON)
add_compile_options(-fsanitize=fuzzer)
endif()

set_sanitizer_envs()
Expand Down Expand Up @@ -127,6 +126,11 @@ endif()
find_or_fetch_abseil()
add_subdirectory(third-party EXCLUDE_FROM_ALL)

if(NURI_BUILD_FUZZING)
add_compile_options(-fsanitize=fuzzer)
string(APPEND CMAKE_CXX_FLAGS " -fprofile-instr-generate -fcoverage-mapping")
endif()

add_compile_options(
-pedantic
-Wall
Expand Down
1 change: 1 addition & 0 deletions fuzz/corpus-min/cif/1a8o.cif
1 change: 1 addition & 0 deletions fuzz/corpus-min/cif/components_stdres.cif
27 changes: 27 additions & 0 deletions fuzz/corpus-min/cif/line_cont.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
data_contin
_test1
;C:\\foldername\\filename
;
_test2
;\\
C:\\foldername\\filename
;
_test3

;\\
C:\\foldername\\file\\
name
;
_test4
;
C:\\foldername\\file\\
name
;
_test5
;\\
C:\\foldername\\file\\\\

name\\


;
27 changes: 27 additions & 0 deletions fuzz/corpus-min/cif/line_cont_new.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
data_contin
_test1
;C:\foldername\filename
;
_test2
;\
C:\foldername\filename
;
_test3

;\
C:\foldername\file\
name
;
_test4
;
C:\foldername\file\
name
;
_test5
;\
C:\foldername\file\\

name\


;
10 changes: 10 additions & 0 deletions fuzz/corpus-min/cif/simple_loop.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
data_loop
loop_
_pdbx_audit_revision_item.ordinal
_pdbx_audit_revision_item.revision_ordinal
_pdbx_audit_revision_item.data_content_type
_pdbx_audit_revision_item.item
1 5 'Structure model' '_atom_site.B_iso_or_equiv'
2 5 'Structure model' '_atom_site.Cartn_x'
3 5 'Structure model' '_atom_site.Cartn_y'
4 5 'Structure model' '_atom_site.Cartn_z'
26 changes: 26 additions & 0 deletions fuzz/corpus-min/cif/star_fig1.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
global_
_compound.trial 4
_compound.source FDA
data_synthesis
_sample.length 5.84
_sample.shape 'needle'
_solvent.base Methanol
_sample.orientation '[1,0,2]'
global_
_experiment.source 'ConvBeamEI'
_experiment.date 2011-06-09
data_experiment
_images.collected 1289
_images.refined 894
save_fragment_1
_molecular.weight 234
_bond_length.max 2.7
save_
save_fragment_2
_molecular.weight 23
_bond_length.max 1.1
_fragment.parent fragment_1
save_
data_publication
_author.details 'A.B. Smith'
_author.laboratory 'LLNL'
9 changes: 9 additions & 0 deletions fuzz/corpus-min/mol2/basic.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@<TRIPOS>MOLECULE
methane
1 0 0 0 0
SMALL
NO_CHARGES


@<TRIPOS>ATOM
1 C1 -0.0127 1.0858 0.0080 C.3
16 changes: 16 additions & 0 deletions fuzz/corpus-min/mol2/cba.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@<TRIPOS>MOLECULE
carboxylic acid
4 3 0 0 0
SMALL
NO_CHARGES


@<TRIPOS>ATOM
1 C1 -0.0127 1.0858 0.0080 C.3
2 C2 -0.7181 1.5718 1.2479 C.2
3 O3 -0.8566 2.8886 1.4687 O.3
4 O4 -1.1590 0.7762 2.0432 O.2
@<TRIPOS>BOND
1 1 2 1
2 2 3 1
3 2 4 2
15 changes: 15 additions & 0 deletions fuzz/corpus-min/mol2/cba2.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@<TRIPOS>MOLECULE
carboxylic acid
4 3 0 0 0
SMALL
GASTEIGER

@<TRIPOS>ATOM
1 C 0.0000 0.0000 0.0000 C.3 1 UNL1 0.0331
2 C 0.0000 0.0000 0.0000 C.2 1 UNL1 0.3016
3 O 0.0000 0.0000 0.0000 O.3 1 UNL1 -0.4808
4 O 0.0000 0.0000 0.0000 O.2 1 UNL1 -0.2513
@<TRIPOS>BOND
1 1 2 1
2 2 3 1
3 2 4 2
16 changes: 16 additions & 0 deletions fuzz/corpus-min/mol2/cba3.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@<TRIPOS>MOLECULE
carboxylate
4 3 0 0 0
SMALL
NO_CHARGES


@<TRIPOS>ATOM
1 C1 -0.0127 1.0858 0.0080 C.3
2 C2 -0.7181 1.5718 1.2479 C.2
3 O3 -0.0841 1.7780 2.2687 O.co2
4 O4 -1.9227 1.7588 1.2302 O.co2
@<TRIPOS>BOND
1 1 2 1
2 2 3 ar
3 2 4 ar
15 changes: 15 additions & 0 deletions fuzz/corpus-min/mol2/cba4.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@<TRIPOS>MOLECULE
carboxylate
4 3 0 0 0
SMALL
GASTEIGER

@<TRIPOS>ATOM
1 C 0.0000 0.0000 0.0000 C.3 1 UNL1 0.1258
2 C 0.0000 0.0000 0.0000 C.2 1 UNL1 0.3654
3 O 0.0000 0.0000 0.0000 O.co2 1 UNL1 -0.2456
4 O 0.0000 0.0000 0.0000 O.co2 1 UNL1 -0.2456
@<TRIPOS>BOND
1 1 2 1
2 2 3 ar
3 2 4 ar
17 changes: 17 additions & 0 deletions fuzz/corpus-min/mol2/charged.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@<TRIPOS>MOLECULE
quaternary ammonium salt
5 4 0 0 0
SMALL
GASTEIGER

@<TRIPOS>ATOM
1 C 0.0000 0.0000 0.0000 C.3 1 UNL1 0.1712
2 N 0.0000 0.0000 0.0000 N.4 1 UNL1 0.3151
3 C 0.0000 0.0000 0.0000 C.3 1 UNL1 0.1712
4 C 0.0000 0.0000 0.0000 C.3 1 UNL1 0.1712
5 C 0.0000 0.0000 0.0000 C.3 1 UNL1 0.1712
@<TRIPOS>BOND
1 1 2 1
2 2 3 1
3 2 4 1
4 2 5 1
18 changes: 18 additions & 0 deletions fuzz/corpus-min/mol2/charged2.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@<TRIPOS>MOLECULE
quaternary ammonium salt
5 4 0 0 0
SMALL
NO_CHARGES


@<TRIPOS>ATOM
1 C1 0.0021 -0.0041 0.0020 C.3
2 N2 -0.0178 1.4648 0.0101 N.4
3 C3 1.3603 1.9732 -0.0003 C.3
4 C4 -0.7283 1.9514 -1.1800 C.3
5 C5 -0.7054 1.9385 1.2187 C.3
@<TRIPOS>BOND
1 1 2 1
2 2 3 1
3 2 4 1
4 2 5 1
24 changes: 24 additions & 0 deletions fuzz/corpus-min/mol2/cpm.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@<TRIPOS>MOLECULE
Cyclopentadienyl anion
5 5 0 0 0
SMALL
GASTEIGER

@<TRIPOS>ATOM
1 C 0.0000 0.0000 0.0000 C.ar 1 UNL1 -0.2250
2 C 0.0000 0.0000 0.0000 C.2 1 UNL1 -0.4635
3 C 0.0000 0.0000 0.0000 C.ar 1 UNL1 -0.2250
4 C 0.0000 0.0000 0.0000 C.ar 1 UNL1 -0.0433
5 C 0.0000 0.0000 0.0000 C.ar 1 UNL1 -0.0433
@<TRIPOS>UNITY_ATOM_ATTR
2 1
charge -1
@<TRIPOS>BOND
1 1 2 ar
2 2 3 ar
3 3 4 ar
4 4 5 ar
5 1 5 ar
# Name: NoName

# Program: corina 4.4.0 0026 12.08.2021
24 changes: 24 additions & 0 deletions fuzz/corpus-min/mol2/cpm2.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@<TRIPOS>MOLECULE
Cyclopentadienyl anion
5 5 0 0 0
SMALL
NO_CHARGES


@<TRIPOS>ATOM
1 C1 1.0980 1.9060 0.0018 C.2
2 C2 -0.0126 1.0758 0.0080 C.2
3 C4 -1.1453 1.8755 0.0170 C.2
4 C5 -0.7347 3.1999 0.0254 C.2
5 C6 0.6517 3.2188 0.0126 C.2
@<TRIPOS>BOND
1 1 5 2
2 1 2 1
3 2 3 1
4 3 4 2
5 4 5 1
@<TRIPOS>UNITY_ATOM_ATTR
2 1
charge -1

# End of record
21 changes: 21 additions & 0 deletions fuzz/corpus-min/mol2/cpm3.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@<TRIPOS>MOLECULE
Cyclopentadienyl anion
5 5 0 0 0
SMALL
GASTEIGER

@<TRIPOS>ATOM
1 C 0.0000 0.0000 0.0000 C.ar 1 UNL1 -0.2250
2 C 0.0000 0.0000 0.0000 C.2 1 UNL1 -0.4635
3 C 0.0000 0.0000 0.0000 C.ar 1 UNL1 -0.2250
4 C 0.0000 0.0000 0.0000 C.ar 1 UNL1 -0.0433
5 C 0.0000 0.0000 0.0000 C.ar 1 UNL1 -0.0433
@<TRIPOS>BOND
1 1 2 ar
2 2 3 ar
3 3 4 ar
4 4 5 ar
5 1 5 ar
# Name: NoName

# Program: corina 4.4.0 0026 12.08.2021
20 changes: 20 additions & 0 deletions fuzz/corpus-min/mol2/cpm4.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@<TRIPOS>MOLECULE
Cyclopentadienyl anion
5 5 0 0 0
SMALL
NO_CHARGES


@<TRIPOS>ATOM
1 C1 1.0980 1.9060 0.0018 C.ar
2 C2 -0.0126 1.0758 0.0080 C.ar
3 C4 -1.1453 1.8755 0.0170 C.ar
4 C5 -0.7347 3.1999 0.0254 C.ar
5 C6 0.6517 3.2188 0.0126 C.ar
@<TRIPOS>BOND
1 1 5 2
2 1 2 1
3 2 3 1
4 3 4 2
5 4 5 1
# End of record
12 changes: 12 additions & 0 deletions fuzz/corpus-min/mol2/extraprop.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@<TRIPOS>MOLECULE
****
1 0 0 0 0
SMALL
GASTEIGER
****

@<TRIPOS>ATOM
1 N 0.0000 0.0000 0.0000 N.4 1 UNL1 1.0000
@<TRIPOS>UNITY_ATOM_ATTR
1 1
test prop
24 changes: 24 additions & 0 deletions fuzz/corpus-min/mol2/guanidine.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@<TRIPOS>MOLECULE
guadinium-like
7 6 0 0 0
SMALL
GASTEIGER

@<TRIPOS>ATOM
1 N 0.0000 0.0000 0.0000 N.pl3 1 UNL1 0.1360
2 C 0.0000 0.0000 0.0000 C.cat 1 UNL1 0.5446
3 N 0.0000 0.0000 0.0000 N.pl3 1 UNL1 0.0168
4 C 0.0000 0.0000 0.0000 C.cat 1 UNL1 0.5446
5 N 0.0000 0.0000 0.0000 N.pl3 1 UNL1 0.1360
6 N 0.0000 0.0000 0.0000 N.pl3 1 UNL1 0.1360
7 N 0.0000 0.0000 0.0000 N.pl3 1 UNL1 0.1360
@<TRIPOS>BOND
1 1 2 1
2 2 3 1
3 3 4 1
4 4 5 1
5 4 6 2
6 2 7 2
# Name: NoName

# Program: corina 4.4.0 0026 12.08.2021
Loading

0 comments on commit 0dd9030

Please sign in to comment.