<Bekwnn>
hey, just thought I'd pop in and ask how you generally go about running unit tests for all parts of a project (or for a particular few directories)?
<g-w1>
see lib/std/std.zig in its `test "" { std.testing.refAllDecls(@This); } essentially runs all tests for all files that it imports. if the files are all connected I would use this.
<Bekwnn>
thanks, that looks like about what I'm looking for
jjsullivan1 has joined #zig
earnestly has quit [Ping timeout: 240 seconds]
hlolli_ has joined #zig
hlolli__ has quit [Ping timeout: 272 seconds]
jjsullivan1 has quit [Ping timeout: 264 seconds]
a92 has quit [Quit: My presence will now cease]
jpe90 has quit [Quit: WeeChat 2.9]
hlolli_ has quit [Ping timeout: 272 seconds]
jjsullivan1 has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
ur5us has quit [Ping timeout: 240 seconds]
dumenci has joined #zig
ur5us has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
jjsullivan1 has quit [Remote host closed the connection]
notzmv has quit [Ping timeout: 240 seconds]
a_chou has joined #zig
a_chou has quit [Remote host closed the connection]
Bekwnn has quit [Remote host closed the connection]
sord937 has joined #zig
xackus_ has joined #zig
ur5us has joined #zig
rzezeski has quit [Quit: Connection closed for inactivity]
drelo has joined #zig
drelo has quit [Remote host closed the connection]
drelo has joined #zig
drelo has quit [Remote host closed the connection]
drelo has joined #zig
hlolli has joined #zig
<drelo>
Hi! Is there a condition variable implemented for zig?
cole-h has quit [Quit: Goodbye]
<novaskell>
drelo: do you mean optionals or?
<gonz_>
No, it's a synchronization construct in C++ (`std::condition_variable`)
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
radgeRayden has quit [Ping timeout: 272 seconds]
<l1x>
hi folks, I am working on a reproducible build project for linux so we can deliver binaries to customers and both side can verify that they got what they think they got
<l1x>
this is a bit trickier problem than it sounds because how we currently build software
<l1x>
since Zig is coming up as a better C i was wondering if you any take on this (building / compiling software a reproducible way)
<l1x>
so what i would like to achieve is an idempotent function that has a few inputs and it always produces the same outputs
<l1x>
the inputs would be the compiler, source files, architecture, something i am not yet aware -> binary that can be verified by checksums
<ikskuh>
i think that might work already assuming everyone uses the same zig compiler
<l1x>
so you do not have any dependency on the outside world? like hostname, time for example
<g-w1>
try it
rzezeski has joined #zig
<daurnimator>
l1x: things zig builds (including when zig is acting as a C compiler) should be reproducible.
<daurnimator>
`zig build` excluded.
<l1x>
daurnimator: sorry zig build is reproducible?
<daurnimator>
l1x: `zig build-exe`, `zig build-lib`, `zig build-obj`, `zig cc` should all be reproducible. `zig build` might not be.
<l1x>
thanks daurnimator !
<g-w1>
you have to make sure that the target is not native, but baseline, though
<daurnimator>
g-w1: its still reproducible, as long as you consider the architecture an input
<g-w1>
I just tried it on 2 different machines and it just worked! I am pleasantly surprised
hlolli_ has joined #zig
hlolli has quit [Ping timeout: 272 seconds]
<semarie>
I want to note that something having *unreproducible* build is a wanted feature :-] . at OpenBSD, we explicitly randomize objects when linking the kernel or some libs (libc, libcrypto) to raise a bit the level of work for an attacker
<daurnimator>
semarie: that's fine if you declare it as an input somehow: e.g. you could introduce a `--layout-seed=12345678`
<ifreund>
you can intentionally make `zig build` unreproducible fairly easily
<cren>
hey all. Sorry if this is a bad question, but how do I free heap allocations I have made? I'm looking at FixedBufferAllocator and it doesn't have, say, a `free` method
<ifreund>
cren: std.mem.Allocator.free()
<ifreund>
or destroy()
<ifreund>
(the first field of FixedBufferAllocator is an std.mem.Allocator)
<cren>
is std.mem.Allocator like an interface?
<ifreund>
yes
<cren>
what is the difference between .free() and .destroy()
<g-w1>
you use destroy with create and free with alloc (one is for arrays and one is for single objects)
waleee-cl has joined #zig
<cren>
I'm allocating an i32 and then calling `try allocator.destroy(ptr);` where `ptr` is what's returned from `.create()`, and I am receiving the error `expected error union type, found void`
<cren>
is this because of the return type of the function (which is `!void`)?
<g-w1>
destroy ALWAYS works (this is in the zen of zig) so you don't need to do try allocator.destroy, just allocator.destroy
<ifreund>
cren: destroy can't fail
<cren>
cool. Is the Zen of Zig written down anywhere like the Python one?
<ifreund>
zig zen
<ifreund>
I really wish I didn't have to handle windows only errors when using std.os and targeting posix only
<GrooveStomp>
Has anyone tried using Zig on Plan9?
ifreund has quit [Ping timeout: 264 seconds]
ifreund has joined #zig
<karchnu>
GrooveStomp: wait, a second person trying zig on Plan9? Is there still an active community somewhere?
gpanders has quit [Ping timeout: 265 seconds]
<g-w1>
you should talk to pixelherodev, I think they use plan 9 as a daily driver. I don't think you can use it now, but once the cbe (c backend) is ready, you should be able to.
<GrooveStomp>
karchnu: Maybe a grassroots movement. :-)
<GrooveStomp>
Thanks g-w1
sawzall has quit [Read error: Connection reset by peer]
sawzall has joined #zig
<marler8997>
andrewrk, how do you cherry pick a PR and get github to mark it as merged?
<marler8997>
or wait, I think I misunderstood your comment, you were just saying you cherry picked the PR to another branch
hlolli_ has quit [Ping timeout: 272 seconds]
<andrewrk>
marler8997, yeah I was just announcing that I had done it
<pixelherodev>
karchnu: yes?
<pixelherodev>
9front is in active development :P
<pixelherodev>
but, I'm not (and won't be) trying Zig on plan9
<marler8997>
pixelherdev why is that?
<pixelherodev>
a) stage1 cannot be ported due to the usage of C++
<pixelherodev>
b) I wouldn't want it ported for that and other reasons
<g-w1>
you will use stage2 with the cbe though?
<marler8997>
^ and also, what are "other reasons"?
<pixelherodev>
c) I have no real motive to use Zig in that space
<pixelherodev>
Even on Linux, there's specific types of tasks where I prefer Zig, and others where I'll probably stick with CC indefinitely
<pixelherodev>
On Plan9, the number of cases where I have a motive to *look* for a non-C language is near-zero
<pixelherodev>
If only because plan9's C compilers are actually sane (unlike e.g. LLVM or GCC :P)
<pixelherodev>
g-w1: I've been contemplating adding plan9 support directly without needing the CBE, but I'm not sure I want to
<pixelherodev>
It'd really just be a separate linker format
<g-w1>
it doesn't use elf?
<pixelherodev>
nope
<karchnu>
sane C compilers? Is this really exists in our universe?
<karchnu>
I will check 9front a bit more then.
<marler8997>
yeah, I realize one of the biggest draws for me with Zig is the sane tooling
<pixelherodev>
karchnu: there's one or two I like on Linux too, but a) not enough backing (9front doesn't have the activity of e.g. GCC, but it does have at least a few dozen people watching it, whereas e.g. cproc has approximately one maintainer :( I still started using it regularly a while back, but I couldn't really recommend it for stable usage at this point ) and b) on Linux, you kinda expect the compiler to
<pixelherodev>
deal with all the Linux crapware that's been made ever :P
<pixelherodev>
I can't use cproc as the system compiler, for instance, because while it will work with *most* C-based packages, it doesn't support a few key features needed for some of them
philtor has joined #zig
<ifreund>
is it close to being able to compile the kernel? is that even a goal?
<pixelherodev>
ifreund: It cannot build it atm for sure, but I don't think that's a goal
<pixelherodev>
Well, actually - given that the author runs a fully static linux distro where cproc is used for currently ~80% of the system, it might be
<ifreund>
ah, same dude that made oasis and that other wayland compositor lib
moo has joined #zig
chivay has quit [Quit: RIP]
moo has quit [Max SendQ exceeded]
moo has joined #zig
wootehfoot has quit [Ping timeout: 256 seconds]
<earnestly>
He was the first to try
chivay has joined #zig
<companion_cube>
The packages that don't compile with cproc, do they use Gnu extensions?
<ifreund>
earnestly: at writing a wayland compositor other than weston?
<earnestly>
ifreund: More or less, yeah. He tried to port dwm
<earnestly>
Well, he did port dwm and then ported dmenu, and then st. That was long ago though
ur5us has joined #zig
<ifreund>
interesting, I forget how long wayland's been around sometimes