Skip to content

Strip the unit-test side of #ifndef __UNIT_TEST__ in strip.py - #134

Open
Stuartwastaken wants to merge 1 commit into
PlatformLab:mainfrom
Stuartwastaken:fix/strip-ifndef-unit-test
Open

Stuartwastaken wants to merge 1 commit into
PlatformLab:mainfrom
Stuartwastaken:fix/strip-ifndef-unit-test

Conversation

@Stuartwastaken

@Stuartwastaken Stuartwastaken commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

strip.py kept both sides of #ifndef __UNIT_TEST__ ... #else ... #endif: the #ifndef starts in the keep state and the #else set keep again instead of switching to strip. So the stripped homa_tx_pool.c defines homa_tx_pool_mem_nid twice (the real one and the unit-test stub) and doesn't compile.

The #else now flips the state. Only homa_tx_pool.c's stripped output changes (the stub is gone); every other file that make net-next copies strips the same as before. python3 util/strip.py homa_tx_pool.c | grep -c '^int homa_tx_pool_mem_nid' gives 2 before and 1 after.

strip.py kept both sides of "#ifndef __UNIT_TEST__ ... #else", so the
stripped homa_tx_pool.c defined homa_tx_pool_mem_nid twice and didn't
compile.
@randomizedcoder

Copy link
Copy Markdown
Contributor

We hit the same bug independently while building the make net-next files in a 7.3 tree (redefinition of 'homa_tx_pool_mem_nid') and came up with the identical fix, so we've dropped ours in favour of this one. The fix looks correct to us: the stripped output of every homa*.[ch] is unchanged except for the stub in homa_tx_pool.c. Together with an sk_memcg fix for kernels without CONFIG_MEMCG, the stripped files build cleanly in-tree (defconfig, W=1, gcc + sparse, clang, and i386). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants