Geek Speak

GoogleTest - the first test

I’m in the process of investigating GoogleTest and the experience has been interesting. I’ve been unit testing code and doing Test Driven Development for a long time now; almost 20 years and I’m still learning. I’ve had my own test code, a simple test framework, that has served me well but it’s not always appropriate so I’m looking for alternatives. I’ll no doubt write about my thoughts on GoogleTest later, once I’ve played a bit more and put my thoughts in order.

VS2022 Version 17.6.0 Preview 3.0 - Standard Library Modules warnings (std.ixx)

So, this morning I’m back from my Easter break and working on some code for a client and the first thing I do is kick off my CI build and things start failing. It seems that my “cunning plan” to have my CI build use the preview version of Visual Studio 2022 whilst the client uses earlier versions has paid off again… We build with all warnings enabled and treat warnings as errors.

Adventures with \Device\Afd

I’ve been playing around with Rust recently and whilst investigating asynchronous programming in Rust I was looking at Tokio, an async runtime. From there I started looking at Mio, the cross-platform, low-level, I/O code that Tokio uses. For Windows platforms Mio uses wepoll, which is a Windows implementation of the Linux epoll API on Windows and is based on the code that is used by libuv for Node.js. This uses networking code that is NOT your standard high-performance Windows networking code using I/O completion ports and instead uses the ‘sparsely documented’ \Device\Afd interface that lies below the Winsock2 layer.

Practical Testing: 39 - 19 years' unit testing the same code

Back in 2004 I started a series of blog posts called “Practical Testing”, about unit testing a non-trivial piece of C++ code. The idea was to show how adding unit tests to existing, real-world, code could be useful and could support future development and refactoring. Episodes 1 though 13 were written in 2004 and covered getting the code under test and fixing some bugs that were complicated to reproduce in a live environment.

LockExplorer is no more

I’ve finally done what I should have done several years ago and shut down the LockExplorer site. I haven’t had the time required to keep the tool up to date and fewer people were interested than I originally expected. I may make the source code available at some point.

SetServiceStatus framework bug

One of my clients has been reporting an intermittent issue with the deployment of new releases of their game server. This runs as a Windows service on many, many, cloud machines and, just sometimes, the service seems to have issues during start up after upgrading the code on a machine that it has otherwise been running fine on. I’ve been adding debug code to our service start up code to try and work out what’s going on and today we had our first hit.

Migrating to Hugo

I have just completed migrating the blog from Movable Type to Hugo. Hopefully everything still works and is in the right place, but do let me know if you find any issues. The comments have been migrated to Disqus. I’ve been wanting to update my websites for quite a while now. I spent quite a lot of effort trying to find someone to do it for me but all of the web companies seemed to lose interest when they realised that I didn’t want an ongoing “SEO” package (I’ve always viewed SEO as “snake oil”).

Allowing renaming but not deleting for files on Windows

I’ve had a client ask if it’s possible to rename his server log file whilst the server is running but not allow deletion. This is harder than you’d expect to achieve. The established view of “the internet” is that NTFS doesn’t support permissions to allow file renaming and still prevent file deletion. This is true. If you want to allow renaming you need to create or open the file with FILE_SHARE_DELETE access and this allows rename AND delete.

Breakpoints that are conditional on other breakpoints...

Back in 2009 I mused on the idea of ‘breakpoint sequences’, where a breakpoint was only hit if a series of previous breakpoints have been hit. This functionality now exists in Visual Studio 2022, and it’s wonderful. It’s useful enough for me to immediately switch from VS2017 to VS2022 as my “day to day” IDE for Windows. Normally I take forever to make the move as I have tools that manage projects and solutions across all the compilers that I support, I just develop in the one that works best for me.

Be careful what you ask for...

As I mentioned in May last year, I’d was having trouble with a client’s system where a UDP DDOS was causing Windows Server machines to use all available non-paged pool and then blue screen. The issue could be reproduced with, what I thought at the time was, a minimal test program that simply created a UDP socket, bound it to a port and then didn’t do anything with it. If something sent a stream of datagrams to that port then non-paged pool usage would grow in an uncontrolled manner until the box became unusable and eventually died.