Rather a long one, but:
A Command Block (such as powered via a redstone clock, or set to always active) will detect an output for test gamemode (so [m=]) only if the gamemode is activated in-game via another Command Block. If a player sets their gamemode via the command line (by pressing T) the block will not detect this – even if triggered directly by redtone after typing the commandline.
I’m sure this never used to be the case, as I’ve used this in the past (I’m sure I have)
Can you specify the exact command syntax that you are using? “/test gamemode” is not a valid command and I am not sure how you could use “/testfor” to detect players’ gamemodes.