investigate and fix MainTest

Investigate the behavior of testSmoke in presense of a populated in directory, as noticed by Karsten in #19373 (moved), comment 3