fix util.py/FileLock and lock_test

Do not pass os.O_TRUNC to open(), that immediately empties out the lock file.

Fix lock_test to be able to catch this error. So far things were happening too
fast to notice it.

Caught by running 'make check' on a main unit APU that has different timing
behavior.

Change-Id: I872a3d2548ac84097ac7acf13cb12c36822e076e
diff --git a/selftest/lock_test.ok b/selftest/lock_test.ok
index 604767b..011a89c 100644
--- a/selftest/lock_test.ok
+++ b/selftest/lock_test.ok
@@ -1,4 +1,14 @@
+creating files
+launch a program that locks a given file, it will create $dir/lock_test
+wait until this lock_test lock file was created by program
+expecting the lock file to reflect "long name"
 launched first, locked by: 'long name'
+launching second program, should find the lock intact and wait
 launched second, locked by: 'long name'
+drop the first lock, $f1 removal signals the first process to stop locking
+wait for first program to carry out the lock release
+now expecting second program to lock
 waited, locked by: 'shorter'
+release the second program also
+expecting the lock to be gone
 waited more, locked by: ''