run-tests: introduce 'warned' as test result
While running, a test resulting in 'warned' is shown as '~'.
Test results with state warned are listed between the skipped and the failed
tests. Example:
Skipped test-revert-flags.t: missing feature: executable bit
Skipped test-inotify-lookup.t: missing feature: inotify extension support
Warned test-something.t: output changed
Failed test-largefiles.t: output changed
Failed test-subrepo.t: output changed
# Ran 11 tests, 2 skipped, 1 warned, 2 failed.
The test result "warned" will be used in later patches.
[ original upstream message ]
#!/usr/bin/env python"""Test the running system for features availability. Exit with zeroif all features are there, non-zero otherwise. If a feature name isprefixed with "no-", the absence of feature is tested."""importoptparseimportsysimporthghavechecks=hghave.checksdeflist_features():forname,featureinchecks.iteritems():desc=feature[1]printname+':',descdeftest_features():failed=0forname,featureinchecks.iteritems():check,_=featuretry:check()exceptException,e:print"feature %s failed: %s"%(name,e)failed+=1returnfailedparser=optparse.OptionParser("%prog [options] [features]")parser.add_option("--test-features",action="store_true",help="test available features")parser.add_option("--list-features",action="store_true",help="list available features")parser.add_option("-q","--quiet",action="store_true",help="check features silently")if__name__=='__main__':options,args=parser.parse_args()ifoptions.list_features:list_features()sys.exit(0)ifoptions.test_features:sys.exit(test_features())quiet=options.quietfailures=0deferror(msg):globalfailuresifnotquiet:sys.stderr.write(msg+'\n')failures+=1forfeatureinargs:negate=feature.startswith('no-')ifnegate:feature=feature[3:]iffeaturenotinchecks:error('skipped: unknown feature: '+feature)sys.exit(2)check,desc=checks[feature]try:available=check()exceptException,e:error('hghave check failed: '+feature)continueifnotnegateandnotavailable:error('skipped: missing feature: '+desc)elifnegateandavailable:error('skipped: system supports %s'%desc)iffailures!=0:sys.exit(1)