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/src/osmo_gsm_tester/util.py b/src/osmo_gsm_tester/util.py
index af6a2f0..197dc97 100644
--- a/src/osmo_gsm_tester/util.py
+++ b/src/osmo_gsm_tester/util.py
@@ -101,7 +101,7 @@
     def __enter__(self):
         if self.f is not None:
             return
-        self.fd = os.open(self.path, os.O_CREAT | os.O_WRONLY | os.O_TRUNC)
+        self.fd = os.open(self.path, os.O_CREAT | os.O_WRONLY)
         fcntl.flock(self.fd, fcntl.LOCK_EX)
         os.truncate(self.fd, 0)
         os.write(self.fd, str(self.owner).encode('utf-8'))