Testing system security in safety-critical applications with adversary