The Python version of the stepdown thread in resmoke.py has a mode where it'll send a SIGTERM to the current primary in order to exercise the clean shutdown and startup recovery codepaths of replication. There's already logic to have the stepdown thread exit (and thus later cause the test to be marked as having failed) if a mongod process within the replica set has already exited abnormally when trying to step down the current primary.
However, the return code from calling primary.mongod.wait() after signaling the current primary to exit is ignored. We should instead raise an errors.ServerFailure exception if after sending a SIGTERM to the mongod process it exited with a non-zero return code. Note that we'll still want to ignore the non-zero return code that's expected after sending a SIGKILL to the mongod process (as happens in the replica_sets_kill_primary_jscore_passthrough.yml test suite).