Author: Maytham Alsudany <maytha8thedev@gmail.com>
Description: Test with local syslog
 Instead of using the (nonexistent) syslog at /var/log/syslog, create a
 temporary syslog and use that during testing.

--- a/pkcs11/pkcs11_test.go
+++ b/pkcs11/pkcs11_test.go
@@ -41,7 +41,7 @@
 
 const (
 	libSoftHSMPath = "/usr/lib/softhsm/libsofthsm2.so"
-	syslogPath     = "/var/log/syslog"
+	syslogPath     = "./syslog.tmp"
 
 	testAdminPIN = "12345"
 	testPIN      = "1234"
@@ -59,6 +59,14 @@
 
 	// Open syslog file and seek to end before the tests starts. Anything read
 	// after this will have been logged during the test.
+	_, err := os.Stat(syslogPath)
+	if os.IsNotExist(err) {
+		file, err := os.Create(syslogPath)
+		if err != nil {
+			t.Fatalf("creating syslog file: %v", err)
+		}
+		defer file.Close()
+	}
 	f, err := os.Open(syslogPath)
 	if err != nil {
 		t.Fatalf("opening syslog file: %v", err)
