commit 6587758fe28e177b97d4feabaf424578b526b746 Author: Jan Tojnar Date: Mon Jun 10 20:53:02 2024 +0200 Create reproducer for cargo-bolero with Nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..cbf5ec7 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,365 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "backtrace" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "bolero" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "449a08ce58d0325f2a1df902aa326a84ab49c6aa2844f1a88fe5e0fc23c75010" +dependencies = [ + "bolero-afl", + "bolero-engine", + "bolero-generator", + "bolero-honggfuzz", + "bolero-kani", + "bolero-libfuzzer", + "cfg-if", + "rand", +] + +[[package]] +name = "bolero-afl" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73c04ea97df540ec2224453cb006f4ab6cacc99636f9f6660b381970448bbaac" +dependencies = [ + "bolero-engine", + "cc", +] + +[[package]] +name = "bolero-engine" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "564c4ee2986f91774e481b578d4a2b62b1a98eba4426112c7e4f2a8c565e016c" +dependencies = [ + "anyhow", + "backtrace", + "bolero-generator", + "lazy_static", + "pretty-hex", + "rand", + "rand_xoshiro", +] + +[[package]] +name = "bolero-generator" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e73cb9bcf03aa9502341f6d2c47de7d0ffd99e40f8e3418b469a87163f4e390" +dependencies = [ + "bolero-generator-derive", + "either", + "rand_core", +] + +[[package]] +name = "bolero-generator-derive" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bea8182a94fa5c6d0db1666969d0094e79d6b93eb68689325a375b1d8804a12b" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "bolero-honggfuzz" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b744c6bda3711a1c88ab7cbd5053b53daca1c7380d05cfa3af39c99d0ec52c0" +dependencies = [ + "bolero-engine", +] + +[[package]] +name = "bolero-kani" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aee97a8044096c7b4a6fb4f5f5003544ad98277ebc7a65567a6c4ea912393388" +dependencies = [ + "bolero-engine", +] + +[[package]] +name = "bolero-libfuzzer" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae3b3751a4b0dc94696063eace32fd9d3ddea904ae9e18d87c81de787023508" +dependencies = [ + "bolero-engine", + "cc", +] + +[[package]] +name = "cc" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "miniz_oxide" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +dependencies = [ + "adler", +] + +[[package]] +name = "my-fibonacci" +version = "0.1.0" +dependencies = [ + "bolero", +] + +[[package]] +name = "object" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" +dependencies = [ + "memchr", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "pretty-hex" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbc83ee4a840062f368f9096d80077a9841ec117e17e7f700df81958f1451254" + +[[package]] +name = "proc-macro-crate" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" +dependencies = [ + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" + +[[package]] +name = "toml_edit" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..bb843df --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "my-fibonacci" +version = "0.1.0" +edition = "2021" + +[profile.fuzz] +inherits = "dev" +opt-level = 3 +incremental = false +codegen-units = 1 + +[dev-dependencies] +bolero = "0.11.1" + +[[test]] +name = "fibonacci_test" +harness = false diff --git a/README.md b/README.md new file mode 100644 index 0000000..9b9e9ca --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +Trying to fuzz the [tutorial](https://camshaft.github.io/bolero/tutorials/fibonacci.html) fails with a linking error: + +```ShellSession +$ nix-shell --run 'cargo bolero test fibonaci_test --sanitizer NONE' + Compiling my-fibonacci v0.1.0 (/home/jtojnar/Projects/cargo-bolero-nix) +error: linking with `cc` failed: exit status: 1 + | + = note: LC_ALL="C" PATH="/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/bin:.:/nix/store/z8dx4c6z528qi2w1p38yzg17g8q5jnln-cargo-1.77.2/bin:/nix/store/4gfh6jmx3czc1n4l2dw8rc2nzbzqarlx-cargo-bolero-0.9.0/bin:/nix/store/j2zdy07sb5nbiskhp5g79c93rj9076n0-rustc-wrapper-1.77.2/bin:/nix/store/nbad47q0m0m9c5xid7zh05hiknwircbp-patchelf-0.15.0/bin:/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin:/nix/store/14c6s4xzhy14i2b05s00rjns2j93gzz4-gcc-13.2.0/bin:/nix/store/c2i631h8i5vcs1sqifwxfsazhwrg6wr5-glibc-2.39-52-bin/bin:/nix/store/php4qidg2bxzmm79vpri025bqi0fa889-coreutils-9.5/bin:/nix/store/kln7kinji3b7sz8r50h4gn9yy6k1js9a-binutils-wrapper-2.41/bin:/nix/store/bgcaxhhxswzvmxjbbgvvaximm5hwghz1-binutils-2.41/bin:/nix/store/php4qidg2bxzmm79vpri025bqi0fa889-coreutils-9.5/bin:/nix/store/jjcsr5gs4qanf7ln5c6wgcq4sn75a978-findutils-4.9.0/bin:/nix/store/i34mknsjgrfyy71k2h79gda0bvagzc2j-diffutils-3.10/bin:/nix/store/5zjms21vpxlkbc0qyl5pmj2sidfmzmd7-gnused-4.9/bin:/nix/store/28gpmx3z6ss3znd7fhmrzmvk3x5lnfbk-gnugrep-3.11/bin:/nix/store/8vvkbgmnin1x2jkp7wcb2zg1p0vc4ks9-gawk-5.2.2/bin:/nix/store/rik7p68cq7yzlj5pmfpf4yv6jnrpvlgf-gnutar-1.35/bin:/nix/store/j5chw7v1x3vlmf3wmdpdb5gwh9hl0b80-gzip-1.13/bin:/nix/store/mxcq77rlan82dzpv3cgj0fh6qvv8ncil-bzip2-1.0.8-bin/bin:/nix/store/cdzpn0rdq810aknww3w9fy3wmw9ixr66-gnumake-4.4.1/bin:/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin:/nix/store/0lfxbmchigx9vs9qmrlbahcy6nxwfnj1-patch-2.7.6/bin:/nix/store/6i4xxaa812vsbli9jkq4mksdddrk27lw-xz-5.4.6-bin/bin:/nix/store/xx7x1dwybpssfhq8yikvzz38bh3yrq97-file-5.45/bin:/run/wrappers/bin:/home/jtojnar/.nix-profile/bin:/nix/profile/bin:/home/jtojnar/.local/state/nix/profile/bin:/etc/profiles/per-user/jtojnar/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin" VSLANG="1033" "cc" "-m64" "/run/user/1000/rustcspbAMX/symbols.o" "/home/jtojnar/Projects/cargo-bolero-nix/target/fuzz/build_3a9a5e244c958d24/x86_64-unknown-linux-gnu/fuzz/deps/my_fibonacci-f4291ade039c958b.my_fibonacci.93e96f14c6d6f6c6-cgu.0.rcgu.o" "/home/jtojnar/Projects/cargo-bolero-nix/target/fuzz/build_3a9a5e244c958d24/x86_64-unknown-linux-gnu/fuzz/deps/my_fibonacci-f4291ade039c958b.3qurakfd59ze1ieb.rcgu.o" "-Wl,--as-needed" "-L" "/home/jtojnar/Projects/cargo-bolero-nix/target/fuzz/build_3a9a5e244c958d24/x86_64-unknown-linux-gnu/fuzz/deps" "-L" "/home/jtojnar/Projects/cargo-bolero-nix/target/fuzz/build_3a9a5e244c958d24/fuzz/deps" "-L" "/home/jtojnar/Projects/cargo-bolero-nix/target/fuzz/build_3a9a5e244c958d24/x86_64-unknown-linux-gnu/fuzz/build/bolero-libfuzzer-ceac76818f48d694/out" "-L" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-1c724dc64cc32d16.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-1dd63bda06d76fcc.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-81d884422ba52c65.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-9fbdbcc598b62ba2.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-40bfb90c61fea8bb.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-95e6fcda3c282ef0.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-4c75151b6abbc292.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-35d5d497b8d90ce6.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-2f6618a016b45d26.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-3713889443fb7bea.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-677d6c5accc4e720.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-664f3e6bf23fe26d.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-fbedc56b0fc6fec3.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-80c24ebfb833516b.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-52b38c8b62b2f7a9.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-753fd57b99b33e72.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-ba50f8b8cf90eac5.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-f43c897f776e3ba4.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-1281b004ca04ec16.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-29711796eaedc6ea.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-f61490b3d499378b.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-48f913ee54104648.rlib" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-1a2195e5af3bb1e3.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/nix/store/0863sk26ypql2h09j8r93h7q0qw22y48-rustc-1.77.2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/jtojnar/Projects/cargo-bolero-nix/target/fuzz/build_3a9a5e244c958d24/x86_64-unknown-linux-gnu/fuzz/deps/my_fibonacci-f4291ade039c958b" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-fuse-ld=gold" + = note: /build/rustc-1.77.2-src/library/std/src/sys_common/backtrace.rs:151: error: undefined reference to '__sancov_lowest_stack' + /build/rustc-1.77.2-src/library/core/src/ops/function.rs:250: error: undefined reference to '__sanitizer_cov_trace_pc_indir' + /build/rustc-1.77.2-src/library/std/src/rt.rs:159: error: undefined reference to '__sancov_lowest_stack' + /build/rustc-1.77.2-src/library/std/src/rt.rs:166: error: undefined reference to '__sancov_lowest_stack' + /build/rustc-1.77.2-src/library/core/src/ops/function.rs:250: error: undefined reference to '__sancov_lowest_stack' + /build/rustc-1.77.2-src/library/core/src/ops/function.rs:250: error: undefined reference to '__sanitizer_cov_trace_pc_indir' + /build/rustc-1.77.2-src/library/core/src/cmp.rs:1573: error: undefined reference to '__sanitizer_cov_trace_const_cmp8' + /home/jtojnar/Projects/cargo-bolero-nix/target/fuzz/build_3a9a5e244c958d24/x86_64-unknown-linux-gnu/fuzz/deps/my_fibonacci-f4291ade039c958b.my_fibonacci.93e96f14c6d6f6c6-cgu.0.rcgu.o:my_fibonacci.93e96f14c6d6f6c6-cgu.0:function sancov.module_ctor_8bit_counters:(.text.sancov.module_ctor_8bit_counters+0x10): error: undefined reference to '__sanitizer_cov_8bit_counters_init' + /home/jtojnar/Projects/cargo-bolero-nix/target/fuzz/build_3a9a5e244c958d24/x86_64-unknown-linux-gnu/fuzz/deps/my_fibonacci-f4291ade039c958b.my_fibonacci.93e96f14c6d6f6c6-cgu.0.rcgu.o:my_fibonacci.93e96f14c6d6f6c6-cgu.0:function sancov.module_ctor_8bit_counters:(.text.sancov.module_ctor_8bit_counters+0x23): error: undefined reference to '__sanitizer_cov_pcs_init' + collect2: error: ld returned 1 exit status + + = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified + = note: use the `-l` flag to specify native libraries to link + = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib) + +error: could not compile `my-fibonacci` (lib test) due to 1 previous error +warning: build failed, waiting for other jobs to finish... +error: getting status result from command BOLERO_FUZZER="libfuzzer" RUSTDOCFLAGS="--cfg fuzzing -Cdebug-assertions -Ctarget-cpu=native -Cdebuginfo=2 -Coverflow_checks -Clink-dead-code -Cpasses=sancov-module --cfg fuzzing_libfuzzer -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-pc-table -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-stack-depth -Clink-arg=-fuse-ld=gold" RUSTFLAGS="--cfg fuzzing -Cdebug-assertions -Ctarget-cpu=native -Cdebuginfo=2 -Coverflow_checks -Clink-dead-code -Cpasses=sancov-module --cfg fuzzing_libfuzzer -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-pc-table -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-stack-depth -Clink-arg=-fuse-ld=gold" "cargo" "test" "--target" "x86_64-unknown-linux-gnu" "--profile" "fuzz" "--target-dir" "target/fuzz/build_3a9a5e244c958d24" "fibonaci_test" "--no-run" "--" "--exact": process exited with status 101 +``` diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..715fb71 --- /dev/null +++ b/shell.nix @@ -0,0 +1,15 @@ +let + nixpkgs = builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/3bcedce9f4de37570242faf16e1e143583407eab.tar.gz"; + sha256 = "sha256-WMU6ZRZrBgEUDIF0siu2aIyVAXcxfElSwzZtS/mSpN4="; + }; + pkgs = import nixpkgs { }; +in + +pkgs.mkShell rec { + nativeBuildInputs = [ + pkgs.cargo + pkgs.cargo-bolero + pkgs.rustc + ]; +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..fde9d49 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,10 @@ +pub fn fibonacci(number: u64) -> u64 { + let mut a = 0; + let mut b = 1; + + for _ in 0..number { + b += core::mem::replace(&mut a, b); + } + + b +} diff --git a/tests/fibonacci_test/corpus/.gitkeep b/tests/fibonacci_test/corpus/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/fibonacci_test/crashes/.gitkeep b/tests/fibonacci_test/crashes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/fibonacci_test/main.rs b/tests/fibonacci_test/main.rs new file mode 100644 index 0000000..b988e1a --- /dev/null +++ b/tests/fibonacci_test/main.rs @@ -0,0 +1,11 @@ +use bolero::check; +use my_fibonacci::fibonacci; + +fn main() { + check!() + .with_type() + .cloned() + .for_each(|number: u64| { + fibonacci(number); + }) +}