Skip to content

Commit

Permalink
Initial run of rustfmt.
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinewallace committed Apr 29, 2020
1 parent ebeae59 commit 5a3ec62
Show file tree
Hide file tree
Showing 75 changed files with 20,760 additions and 7,720 deletions.
24 changes: 16 additions & 8 deletions fuzz/src/bin/chanmon_consistency_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ extern crate lightning_fuzz;
use lightning_fuzz::chanmon_consistency::*;

#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[macro_use]
extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
Expand All @@ -16,7 +17,8 @@ fn main() {
}

#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
Expand All @@ -27,7 +29,8 @@ fn main() {
}

#[cfg(feature = "libfuzzer_fuzz")]
#[macro_use] extern crate libfuzzer_sys;
#[macro_use]
extern crate libfuzzer_sys;
#[cfg(feature = "libfuzzer_fuzz")]
fuzz_target!(|data: &[u8]| {
chanmon_consistency_run(data.as_ptr(), data.len());
Expand All @@ -44,9 +47,9 @@ fn main() {

#[test]
fn run_test_cases() {
use lightning_fuzz::utils::test_logger::StringBuffer;
use std::fs;
use std::io::Read;
use lightning_fuzz::utils::test_logger::StringBuffer;

use std::sync::{atomic, Arc};
{
Expand All @@ -64,20 +67,25 @@ fn run_test_cases() {

let thread_count_ref = Arc::clone(&threads_running);
let main_thread_ref = std::thread::current();
threads.push((path.file_name().unwrap().to_str().unwrap().to_string(),
threads.push((
path.file_name().unwrap().to_str().unwrap().to_string(),
std::thread::spawn(move || {
let string_logger = StringBuffer::new();

let panic_logger = string_logger.clone();
let res = if ::std::panic::catch_unwind(move || {
chanmon_consistency_test(&data, panic_logger);
}).is_err() {
})
.is_err()
{
Some(string_logger.into_string())
} else { None };
} else {
None
};
thread_count_ref.fetch_sub(1, atomic::Ordering::AcqRel);
main_thread_ref.unpark();
res
})
}),
));
while threads_running.load(atomic::Ordering::Acquire) > 32 {
std::thread::park();
Expand Down
24 changes: 16 additions & 8 deletions fuzz/src/bin/chanmon_deser_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ extern crate lightning_fuzz;
use lightning_fuzz::chanmon_deser::*;

#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[macro_use]
extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
Expand All @@ -16,7 +17,8 @@ fn main() {
}

#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
Expand All @@ -27,7 +29,8 @@ fn main() {
}

#[cfg(feature = "libfuzzer_fuzz")]
#[macro_use] extern crate libfuzzer_sys;
#[macro_use]
extern crate libfuzzer_sys;
#[cfg(feature = "libfuzzer_fuzz")]
fuzz_target!(|data: &[u8]| {
chanmon_deser_run(data.as_ptr(), data.len());
Expand All @@ -44,9 +47,9 @@ fn main() {

#[test]
fn run_test_cases() {
use lightning_fuzz::utils::test_logger::StringBuffer;
use std::fs;
use std::io::Read;
use lightning_fuzz::utils::test_logger::StringBuffer;

use std::sync::{atomic, Arc};
{
Expand All @@ -64,20 +67,25 @@ fn run_test_cases() {

let thread_count_ref = Arc::clone(&threads_running);
let main_thread_ref = std::thread::current();
threads.push((path.file_name().unwrap().to_str().unwrap().to_string(),
threads.push((
path.file_name().unwrap().to_str().unwrap().to_string(),
std::thread::spawn(move || {
let string_logger = StringBuffer::new();

let panic_logger = string_logger.clone();
let res = if ::std::panic::catch_unwind(move || {
chanmon_deser_test(&data, panic_logger);
}).is_err() {
})
.is_err()
{
Some(string_logger.into_string())
} else { None };
} else {
None
};
thread_count_ref.fetch_sub(1, atomic::Ordering::AcqRel);
main_thread_ref.unpark();
res
})
}),
));
while threads_running.load(atomic::Ordering::Acquire) > 32 {
std::thread::park();
Expand Down
24 changes: 16 additions & 8 deletions fuzz/src/bin/full_stack_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ extern crate lightning_fuzz;
use lightning_fuzz::full_stack::*;

#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[macro_use]
extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
Expand All @@ -16,7 +17,8 @@ fn main() {
}

#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
Expand All @@ -27,7 +29,8 @@ fn main() {
}

#[cfg(feature = "libfuzzer_fuzz")]
#[macro_use] extern crate libfuzzer_sys;
#[macro_use]
extern crate libfuzzer_sys;
#[cfg(feature = "libfuzzer_fuzz")]
fuzz_target!(|data: &[u8]| {
full_stack_run(data.as_ptr(), data.len());
Expand All @@ -44,9 +47,9 @@ fn main() {

#[test]
fn run_test_cases() {
use lightning_fuzz::utils::test_logger::StringBuffer;
use std::fs;
use std::io::Read;
use lightning_fuzz::utils::test_logger::StringBuffer;

use std::sync::{atomic, Arc};
{
Expand All @@ -64,20 +67,25 @@ fn run_test_cases() {

let thread_count_ref = Arc::clone(&threads_running);
let main_thread_ref = std::thread::current();
threads.push((path.file_name().unwrap().to_str().unwrap().to_string(),
threads.push((
path.file_name().unwrap().to_str().unwrap().to_string(),
std::thread::spawn(move || {
let string_logger = StringBuffer::new();

let panic_logger = string_logger.clone();
let res = if ::std::panic::catch_unwind(move || {
full_stack_test(&data, panic_logger);
}).is_err() {
})
.is_err()
{
Some(string_logger.into_string())
} else { None };
} else {
None
};
thread_count_ref.fetch_sub(1, atomic::Ordering::AcqRel);
main_thread_ref.unpark();
res
})
}),
));
while threads_running.load(atomic::Ordering::Acquire) > 32 {
std::thread::park();
Expand Down
24 changes: 16 additions & 8 deletions fuzz/src/bin/msg_accept_channel_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_accept_channel::*;

#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[macro_use]
extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
Expand All @@ -16,7 +17,8 @@ fn main() {
}

#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
Expand All @@ -27,7 +29,8 @@ fn main() {
}

#[cfg(feature = "libfuzzer_fuzz")]
#[macro_use] extern crate libfuzzer_sys;
#[macro_use]
extern crate libfuzzer_sys;
#[cfg(feature = "libfuzzer_fuzz")]
fuzz_target!(|data: &[u8]| {
msg_accept_channel_run(data.as_ptr(), data.len());
Expand All @@ -44,9 +47,9 @@ fn main() {

#[test]
fn run_test_cases() {
use lightning_fuzz::utils::test_logger::StringBuffer;
use std::fs;
use std::io::Read;
use lightning_fuzz::utils::test_logger::StringBuffer;

use std::sync::{atomic, Arc};
{
Expand All @@ -64,20 +67,25 @@ fn run_test_cases() {

let thread_count_ref = Arc::clone(&threads_running);
let main_thread_ref = std::thread::current();
threads.push((path.file_name().unwrap().to_str().unwrap().to_string(),
threads.push((
path.file_name().unwrap().to_str().unwrap().to_string(),
std::thread::spawn(move || {
let string_logger = StringBuffer::new();

let panic_logger = string_logger.clone();
let res = if ::std::panic::catch_unwind(move || {
msg_accept_channel_test(&data, panic_logger);
}).is_err() {
})
.is_err()
{
Some(string_logger.into_string())
} else { None };
} else {
None
};
thread_count_ref.fetch_sub(1, atomic::Ordering::AcqRel);
main_thread_ref.unpark();
res
})
}),
));
while threads_running.load(atomic::Ordering::Acquire) > 32 {
std::thread::park();
Expand Down
24 changes: 16 additions & 8 deletions fuzz/src/bin/msg_announcement_signatures_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ extern crate lightning_fuzz;
use lightning_fuzz::msg_targets::msg_announcement_signatures::*;

#[cfg(feature = "afl")]
#[macro_use] extern crate afl;
#[macro_use]
extern crate afl;
#[cfg(feature = "afl")]
fn main() {
fuzz!(|data| {
Expand All @@ -16,7 +17,8 @@ fn main() {
}

#[cfg(feature = "honggfuzz")]
#[macro_use] extern crate honggfuzz;
#[macro_use]
extern crate honggfuzz;
#[cfg(feature = "honggfuzz")]
fn main() {
loop {
Expand All @@ -27,7 +29,8 @@ fn main() {
}

#[cfg(feature = "libfuzzer_fuzz")]
#[macro_use] extern crate libfuzzer_sys;
#[macro_use]
extern crate libfuzzer_sys;
#[cfg(feature = "libfuzzer_fuzz")]
fuzz_target!(|data: &[u8]| {
msg_announcement_signatures_run(data.as_ptr(), data.len());
Expand All @@ -44,9 +47,9 @@ fn main() {

#[test]
fn run_test_cases() {
use lightning_fuzz::utils::test_logger::StringBuffer;
use std::fs;
use std::io::Read;
use lightning_fuzz::utils::test_logger::StringBuffer;

use std::sync::{atomic, Arc};
{
Expand All @@ -64,20 +67,25 @@ fn run_test_cases() {

let thread_count_ref = Arc::clone(&threads_running);
let main_thread_ref = std::thread::current();
threads.push((path.file_name().unwrap().to_str().unwrap().to_string(),
threads.push((
path.file_name().unwrap().to_str().unwrap().to_string(),
std::thread::spawn(move || {
let string_logger = StringBuffer::new();

let panic_logger = string_logger.clone();
let res = if ::std::panic::catch_unwind(move || {
msg_announcement_signatures_test(&data, panic_logger);
}).is_err() {
})
.is_err()
{
Some(string_logger.into_string())
} else { None };
} else {
None
};
thread_count_ref.fetch_sub(1, atomic::Ordering::AcqRel);
main_thread_ref.unpark();
res
})
}),
));
while threads_running.load(atomic::Ordering::Acquire) > 32 {
std::thread::park();
Expand Down
Loading

0 comments on commit 5a3ec62

Please sign in to comment.