Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

VikingofRock posted:

Could you elaborate on your CI setup? I've been improving the tests for my astronomy research C++ code, and I think a good next step would be setting up some CI. This is especially important now because more undergrads are contributing code to it and they are likely to mess things up due to inexperience.

Do you do anything besides compile, run cppcheck (or another linter), and run unit tests? For example, do you do anything to ensure that your code is valgrind clean?

doing valgrind (or even asan) gatekeeping is probably too slow unless your project is tiny, but it makes sense to have a periodic valgrind/asan build that just runs your normal test suite, or at least a stripped-down version of your test suite

Adbot
ADBOT LOVES YOU

cinci zoo sniper
Mar 15, 2013




gonadic io posted:

starting from scratch, no prior code. starting to building on an empty (green) field

ah. yeah i imagine that rough in c or c++

comedy option: this is how i Imagine lisp programming, working your way up from a pair of parentheses

VikingofRock
Aug 24, 2008




rjmccall posted:

doing valgrind (or even asan) gatekeeping is probably too slow unless your project is tiny, but it makes sense to have a periodic valgrind/asan build that just runs your normal test suite, or at least a stripped-down version of your test suite

That's sort of what I was thinking--run valgrind on the test suite. Is there anything else I should be throwing at the code to check it?

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

ah. yeah i imagine that rough in c or c++

comedy option: this is how i Imagine lisp programming, working your way up from a pair of parentheses

class Main {
____public static void main(String[] args) {
________:ins:
____}
}



e: im dumb and couldn't figure out how to both preserve spaces and display the cursor smiley

Xarn
Jun 26, 2015

VikingofRock posted:

Could you elaborate on your CI setup? I've been improving the tests for my astronomy research C++ code, and I think a good next step would be setting up some CI. This is especially important now because more undergrads are contributing code to it and they are likely to mess things up due to inexperience.

Do you do anything besides compile, run cppcheck (or another linter), and run unit tests? For example, do you do anything to ensure that your code is valgrind clean?

To ensure the code is Valgrind clean, I run the tests under Valgrind, duh :v:

(Actually, I run it under Clang's sanitizers, because the full set of tests can take days even without any extra slowdown, so Valgrind's 2 orders of magnitude would kill me)


Anyway, in my current paid project (also research, sup buddy), we have 2 different granularities, per commit and per ~2 weeks.

Per commit we compile and run unit tests with various compilers, and then also compile and run the unit tests with Clang's sanitizers. The commits are not gated, but you are expected to fix poo poo after you get a nastygram about all the things you broke.

Then, every ~2 weeks or before we branch a release, we run full test suite (basically all inputs that our customers have given back to us because they contained bug). It takes ages to run, but can catch some bugs our unit tests don't.

We are thinking about also having static analysis run after commit, but small team + different priorities means that we don't have time to set it up properly, and so far we are pretty okay with our current setup (also jacked up warnings).



In my non-paid OSS project I have AppVeyor and TravisCI compile and run unit tests. I would love to add sanitizers/Valgrind, but I can't be arsed to figure out how to use them under Travis :shrug:

BONGHITZ
Jan 1, 1970

why do you program?

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

gonadic io posted:

class Main {
____public static void main(String[] args) {
________:ins:
____}
}



e: im dumb and couldn't figure out how to both preserve spaces and display the cursor smiley
& nbsp ;

gonadic io
Feb 16, 2011

>>=

BONGHITZ posted:

why do you program?

i really really like it. honestly it makes me feel smart when things come together and a problem is solved.
like a cross between a soduku puzzle and writing a novel. that's not something i'd admit irl but surely this safe space can accept my need to feel smart.

i prefer hobby programming because you can just do whatever interests you but work programming is fine

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

VikingofRock posted:

That's sort of what I was thinking--run valgrind on the test suite. Is there anything else I should be throwing at the code to check it?

asan catches a subtly different set of bugs from valgrind and is a lot cheaper. tsan is great if you use threads. ubsan is cheap enough to be part of your normal debug-mode ci. static analysis tools

you can always write more tooling. a lot of projects would benefit from some project- or framework-specific static analysis. just think about the common bugs that people make, think about whether you could reasonably catch those bugs statically. but before you actually write that analysis, consider whether you can actually just fix the original api to define the problem away

rjmccall fucked around with this message at 08:42 on Oct 10, 2017

Xarn
Jun 26, 2015

gonadic io posted:

i really really like it. honestly it makes me feel smart when things come together and a problem is solved.
like a cross between a soduku puzzle and writing a novel. that's not something i'd admit irl but surely this safe space can accept my need to feel smart.

i prefer hobby programming because you can just do whatever interests you but work programming is fine

:same: except I kinda prefer work programming*


* I haven't had to deal with large corp bullshit for couple of years

redleader
Aug 18, 2005

Engage according to operational parameters
test suite? i think you'll find that this is the terrible programmers thread

cinci zoo sniper
Mar 15, 2013




i like programming because i like process of problem solving, also seeing how things work.

not sure if i like hobby programming more than work programming, since ive done barely any of the former



*** "programming" as in scientific scripts, data analysis, etc is what i do for work or "work", not something "real" (or even just web)

cinci zoo sniper
Mar 15, 2013




redleader posted:

test suite? i think you'll find that this is the terrible programmers thread

ill let u know i version my sql scripts in git

Slurps Mad Rips
Jan 25, 2009

Bwaltow!

BONGHITZ posted:

why do you program?

i aint good at arguin' i cant draw good and ah dont english well neither

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal

BONGHITZ posted:

why do you program?

i'm terrible on every conceivable level so it's basically made for me

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen

BONGHITZ posted:

why do you program?

i'm a miserable pile of illogical secretions

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

VikingofRock posted:

That's sort of what I was thinking--run valgrind on the test suite. Is there anything else I should be throwing at the code to check it?

the hardcore option (extremely time and resource intensive) is:
run the code through KLEE (white box testing tool) to generate test cases
run the test cases through AFL (instrumentation-driven fuzzer) to find the corner cases KLEE can't

(disclaimer: I have used KLEE and AFL in isolation, but never together)

KLEE on its own can also be used to test your implementation against a known good reference implementation. it has, however, a lot of limitations on the kind of inputs it can generate, so it's not always appropriate. it's also an academic project with all that it entails

the main weakness of both tools is that they require access to the full program for perfect coverage, so any external dependencies should be compiled with them as well, but often this just isn't feasible. AFL's randomized nature, however, compensates a lot


what do you write your unit tests in?

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

BONGHITZ posted:

why do you program?

it's an addiction I get paid for

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

rjmccall posted:

i have no idea what you're trying to describe here. a non-fifo queue that does some sort of uniquing?

i guess a keyed cache if i thought about it a little more

Xarn
Jun 26, 2015

hackbunny posted:

the hardcore option (extremely time and resource intensive) is:
run the code through KLEE (white box testing tool) to generate test cases
run the test cases through AFL (instrumentation-driven fuzzer) to find the corner cases KLEE can't

(disclaimer: I have used KLEE and AFL in isolation, but never together)

KLEE on its own can also be used to test your implementation against a known good reference implementation. it has, however, a lot of limitations on the kind of inputs it can generate, so it's not always appropriate. it's also an academic project with all that it entails

the main weakness of both tools is that they require access to the full program for perfect coverage, so any external dependencies should be compiled with them as well, but often this just isn't feasible. AFL's randomized nature, however, compensates a lot

Please note that if you do something so exotic as to calculate a non-trivial hash over symbolic inputs and then branch over it, KLEE will never finish running.

To explain, KLEE is a symbolic executor. That means that it executes the code as written, except you mark some part of the memory as symbolic, so when it hits a branch that depends on values in the symbolic memory, it goes down both ways of the execution, applying the constraints. You can then either mark some regions as error-if-reached, or just use its built-in knowledge (ie. dereferencing null pointers is a bad idea), and if it manages to find execution path that leads to an error, it notifies you of the execution path and gives you a value for the symbolic memory that will lead to program to the same place.

It also has some extras, like optionally notifying on integer overflow, kinda-sorta understanding files and so on.


And yeah, back when I worked with it, it had all the signs of massively PITA academic project: super-old dependencies, vague installation steps, rather sparse documentation (I've ended up figuring things out by reading code and sometimes posting to the mailing list) and so on.

hackbunny posted:

what do you write your unit tests in?
Catch

AggressivelyStupid
Jan 9, 2012

ynohtna posted:

i'm a miserable pile of illogical secretions

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

Xarn posted:

You can then either mark some regions as error-if-reached, or just use its built-in knowledge (ie. dereferencing null pointers is a bad idea), and if it manages to find execution path that leads to an error, it notifies you of the execution path and gives you a value for the symbolic memory that will lead to program to the same place.

you don't really use KLEE to find errors, though, you use it to create a minimal set of inputs that will get 100% test coverage (which, counterintuitively, isn't very useful on its own)

Xarn
Jun 26, 2015

hackbunny posted:

you don't really use KLEE to find errors, though, you use it to create a minimal set of inputs that will get 100% test coverage (which, counterintuitively, isn't very useful on its own)

True, but 100% path coverage according to KLEE doesn't really mean exercising all paths anyway, as the last time* I used KLEE it didn't consider ie overflowing as a separate path, so you still want it to check these for you. Alsoit likes to get stuck in trivially identical paths (ask me about letting it run for a week over piece of engine control code and it ended up trying to generate all possible messages + checksums it could receive over a bus :v:),


*Admittedly that was pretty long ago, I ended up hacking-in overflow detection just to find out that somebody else up-streamed it around the same time...

Colonel Taint
Mar 14, 2004


Sapozhnik posted:

cool now port the build to meson and groan at how much time you could have saved

I'm actually going to attempt this. Part of the refactoring was making all the makefiles use a central, globally selectable general rules file, and supplying some parameters to it (eg objects to build, target) per directory.

I'm thinking I can basically supply an alternate rules file that will just generate the meson.build files, but this would mean that users have to do an extra configure step before building a target. Right now I can do 'make app1 & make app2 & make app3' from the build directory where the recipes for the apps can vary wildly. I'm still learning about meson, but I don't see any obvious way to be able to do this in the system.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

BONGHITZ posted:

why do you program?

I just do, ok? For fucks sake dad just leave me alone, you wouldn't understand.

It pays magnificently and I get to talk to nerds all day.

jesus WEP
Oct 17, 2004


god drat sourcetree gets more broken with every release

Maximum Leader
Dec 5, 2014

St Evan Echoes posted:

god drat sourcetree gets more broken with every release

its trash but i dont know anything better

cinci zoo sniper
Mar 15, 2013




St Evan Echoes posted:

god drat sourcetree gets more broken with every release

aye, i used to like it but it has become more sluggish and "courageous" with every release so i ended up with just slamming git integration switch on in every tool that matters (intellij, visual studio, st3), and use gitkraken if i really really can't help it

cinci zoo sniper
Mar 15, 2013




Maximum Leader posted:

its trash but i dont know anything better

try gitkraken. not necessarily better, but was a breath of fresh air after sourcetree

speaking of git integration in dev tools, visual studio is so bad about it it's not even funny

gonadic io
Feb 16, 2011

>>=
i starting using github desktop, but it has essentially no features and is a useless pile of Electron (pretty ui though)

cinci zoo sniper
Mar 15, 2013




gonadic io posted:

i starting using github desktop, but it has essentially no features and is a useless pile of Electron (pretty ui though)

i tried it and i didn't like it too much, probably because electron stuff often lags on my pc. well i guess it helps to mainly work in bitbucket (and i prolly tried some super early beta)

jesus WEP
Oct 17, 2004


cinci zoo sniper posted:

try gitkraken. not necessarily better, but was a breath of fresh air after sourcetree

speaking of git integration in dev tools, visual studio is so bad about it it's not even funny

gitkraken is pretty good but i think it constantly runs git fetch or smth. it tanks my repo performance anyway

jesus WEP
Oct 17, 2004


excel 2007 was the last program i ever used that somehow broke the "click/drag title bar to unmaximise and move", until sourcetree managed it a couple months ago

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
sourcetree has a bug in macos where it slowly consumes file handles until it tanks your system. sometimes even if you shut it down the handles still aren't freed up and you have to reboot :cool:

cinci zoo sniper
Mar 15, 2013




St Evan Echoes posted:

gitkraken is pretty good but i think it constantly runs git fetch or smth. it tanks my repo performance anyway

:rip:, i never tried it with a repo exceeding single digit megabytes

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
you could make a lot of money selling a well-performing graphical git tool to idiots

cinci zoo sniper
Mar 15, 2013




CRIP EATIN BREAD posted:

you could make a lot of money selling a well-performing graphical git tool to idiots

*sights drawing keyboard*

HoboMan
Nov 4, 2010

CRIP EATIN BREAD posted:

you could make a lot of money selling a well-performing graphical git tool to idiots

being an idiot that needs such a tool i might actually do this

i've not made a gui that's not javafx or html though, so i don't know about "well-performing"

cinci zoo sniper
Mar 15, 2013




HoboMan posted:

being an idiot that needs such a tool i might actually do this

i've not made a gui that's not javafx or html though, so i don't know about "well-performing"

javafx is ok-performing for a visual git thing, i think? just dont make another node.exe for the love of god

Adbot
ADBOT LOVES YOU

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo

BONGHITZ posted:

why do you program?

Maximum Leader posted:

its trash but i dont know anything better

  • Locked thread