Instance Logo

lethargic.talkative.fish

goto: blackle @suricrasia
Nov 24, 16:46

does there exist a program that dynamically links an executable (this seems like an oxymoron but it's possible, see witchcraft compiler collection) then loops over all the symbols and then runs any function that matches the pattern "TEST_*"

Nov 24, 2022, 16:46
3
4
22
View toot
goto: blackle @suricrasia
Nov 24, 16:47

c has reflection people are just cowards

Nov 24, 2022, 16:47
4
17
62
View toot
tekknolagi @tekknolagi@mastodon.social
Nov 24, 17:17

@suricrasia I'm feeling very nerd sniped

I think people normally do this by registering something at top-level, like in gtest, and I also have no idea how that works

Nov 24, 2022, 17:17
0
0
1
View toot
goto: blackle @suricrasia
Nov 24, 16:55

it would also be cool if this was a long-lived process that dlcloses/dlopens the executable whenever it detects that the file changed, then re-runs the test

also, imagine if it also automatically fuzzed symbols matching the pattern FUZZ_* ?

Nov 24, 2022, 16:55
2
0
13
View toot
Imdat :heart_nb: :verified: @imdat@tech.lgbt
Nov 24, 18:32

@suricrasia …. Aaaaand there… Another crazy idea I **have** to try out!

Nov 24, 2022, 18:32
0
0
1
View toot
ThePhD @thephd@pony.social
Nov 24, 17:58

@suricrasia These are all rad ideas. They're also probably the foundation of some of the "hot reload" features in some engines.

Nov 24, 2022, 17:58
1
0
1
View toot
Jens Finkhäuser 🌻 @jens@social.finkhaeuser.de
Nov 24, 18:04

@thephd @suricrasia Kind of, but portability may be an issue. But you could easily hack around it by using dlsym to find a well-known symbol that's a data structure of your own devising, in which you keep a symbol table.

Nov 24, 2022, 18:04
2
0
1
View toot
goto: blackle @suricrasia
Nov 24, 18:05

@jens @thephd I'm kinda interested to see what might be possible if portability wasn't a concern (at least for development environments)

Nov 24, 2022, 18:05
1
0
1
View toot
Jens Finkhäuser 🌻 @jens@social.finkhaeuser.de
Nov 24, 18:06

@suricrasia @thephd Well, if you're thinking about Linux, libelf is your friend, I suppose!

Nov 24, 2022, 18:06
0
0
1
View toot
ThePhD @thephd@pony.social
Nov 24, 18:04

@jens @suricrasia That gets rid of the magic of it, though. If you have to keep your own data structure, you've got to fill it with something.

Nov 24, 2022, 18:04
1
0
1
View toot
Nov 24, 2022, 18:05
1
0
1
View toot
Jens Finkhäuser 🌻 @jens@social.finkhaeuser.de
Nov 24, 18:08

@thephd @suricrasia FWIW, every unit test suite I know does something like that. The macros you wrap your test declaration in add to the "symbol table", and the runner iterates over this.

Nov 24, 2022, 18:08
0
0
1
View toot
Boop @boop@jorts.horse
Nov 24, 16:47

@suricrasia Reflection is just useful quines

Nov 24, 2022, 16:47
0
0
1
View toot