diff --git a/tests/mutex_order/tests/01-run.py b/tests/mutex_order/tests/01-run.py new file mode 100755 index 0000000000..7448a66b46 --- /dev/null +++ b/tests/mutex_order/tests/01-run.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2016 Kaspar Schleiser +# Copyright (C) 2016 Oliver Hahm +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. + +import os +import sys + +sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner')) +import testrunner + +thread_prio = { + 3: 6, + 4: 4, + 5: 0, + 6: 2, + 7: 1 + } + +def testfunc(child): + for k in thread_prio.keys(): + child.expect(u"T%i \(prio %i\): trying to lock mutex now" % (k, thread_prio[k])) + + last = -1 + for i in range(len(thread_prio)): + child.expect(u"T\d+ \(prio (\d+)\): locked mutex now") + assert(int(child.match.group(1)) > last) + last = int(child.match.group(1)) + +if __name__ == "__main__": + sys.exit(testrunner.run(testfunc))