[Spice-devel] [PATCH spice-server] test-leaks: Checks some leaks using TLS
Frediano Ziglio
fziglio at redhat.com
Tue Mar 7 16:55:50 UTC 2017
Verify stuff are freed correctly (like TLS context).
The different PKI file required are generated with
base values (localhost and rsa 1024).
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/tests/Makefile.am | 1 +
server/tests/pki/ca-cert.pem | 16 ++++++++++++++++
server/tests/pki/server-cert.pem | 18 ++++++++++++++++++
server/tests/pki/server-key.pem | 15 +++++++++++++++
server/tests/test-leaks.c | 9 +++++++++
5 files changed, 59 insertions(+)
create mode 100644 server/tests/pki/ca-cert.pem
create mode 100644 server/tests/pki/server-cert.pem
create mode 100644 server/tests/pki/server-key.pem
diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
index db23177..3f61faa 100644
--- a/server/tests/Makefile.am
+++ b/server/tests/Makefile.am
@@ -1,6 +1,7 @@
NULL =
AM_CPPFLAGS = \
+ -DSPICE_TOP_SRCDIR=\"$(abs_top_srcdir)\"\
-I$(top_srcdir) \
-I$(top_srcdir)/server \
-I$(top_builddir)/server \
diff --git a/server/tests/pki/ca-cert.pem b/server/tests/pki/ca-cert.pem
new file mode 100644
index 0000000..a2068ce
--- /dev/null
+++ b/server/tests/pki/ca-cert.pem
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIICkTCCAfoCCQCRTWOpSfdW3jANBgkqhkiG9w0BAQsFADCBjDELMAkGA1UEBhMC
+VUsxCzAJBgNVBAgMAkNBMRIwEAYDVQQHDAlDYW1icmlkZ2UxEzARBgNVBAoMCkV4
+YW1wbGUgQ28xEDAOBgNVBAsMB3RlY2hvcHMxEzARBgNVBAMMClRlc3RpbmcgQ0Ex
+IDAeBgkqhkiG9w0BCQEWEWNlcnRzQGV4YW1wbGUuY29tMB4XDTE3MDMwNTE1NTE0
+NFoXDTQ0MDcyMDE1NTE0NFowgYwxCzAJBgNVBAYTAlVLMQswCQYDVQQIDAJDQTES
+MBAGA1UEBwwJQ2FtYnJpZGdlMRMwEQYDVQQKDApFeGFtcGxlIENvMRAwDgYDVQQL
+DAd0ZWNob3BzMRMwEQYDVQQDDApUZXN0aW5nIENBMSAwHgYJKoZIhvcNAQkBFhFj
+ZXJ0c0BleGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA8ZzC
+wYryCMwWSPJMrFCDn73+twpMfpW4J2DR+HTT3nBcjW5gIfZ6fUZWn0wovfeDqMiU
+1cKtJY45U14kwvZDuVTIZtpvqWAVX4t+KYN1MQuWuQsN7f9q6VEi0hyI9CiTi8PY
+tW2r0d/1SDdV4oKQBVwv15/zFJCETM38DPAxnYkCAwEAATANBgkqhkiG9w0BAQsF
+AAOBgQBw8BUg4l0EuZxy2F6z/wG7VSruHQupFexsJpIsr268wotpYnvAigXYCsh6
+PB042JHhBZs317GolUEExxWiLMjKcpggYYHX4WpA9nuN/QpK+1CrUmlILIrgTScY
+1Z7U7bRko3gBuF5dd7DneZQZGWBfpaqDbeufs1ZDTp5cIV8K5A==
+-----END CERTIFICATE-----
diff --git a/server/tests/pki/server-cert.pem b/server/tests/pki/server-cert.pem
new file mode 100644
index 0000000..cc90111
--- /dev/null
+++ b/server/tests/pki/server-cert.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC6DCCAlGgAwIBAgIJAKa/0Imqt34SMA0GCSqGSIb3DQEBCwUAMIGMMQswCQYD
+VQQGEwJVSzELMAkGA1UECAwCQ0ExEjAQBgNVBAcMCUNhbWJyaWRnZTETMBEGA1UE
+CgwKRXhhbXBsZSBDbzEQMA4GA1UECwwHdGVjaG9wczETMBEGA1UEAwwKVGVzdGlu
+ZyBDQTEgMB4GCSqGSIb3DQEJARYRY2VydHNAZXhhbXBsZS5jb20wHhcNMTcwMzA1
+MTU1MTQ0WhcNMTkxMTI5MTU1MTQ0WjCBizELMAkGA1UEBhMCVUsxCzAJBgNVBAgM
+AkNBMRIwEAYDVQQHDAlDYW1icmlkZ2UxETAPBgNVBAoMCEZyZWRpYW5vMRAwDgYD
+VQQLDAd0ZWNob3BzMRQwEgYDVQQDDAtUZXN0IFNlcnZlcjEgMB4GCSqGSIb3DQEJ
+ARYRY2VydHNAZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
+AL7GOdOpqx26TSA/lQCOAcPGZ6mWhCtRUVaWXn+AKdmyNQ477ioSY2sSvTyYAodO
+hOHJo9UXQJ9Q526A4rGizCFZ4AdTX14j0Hf1V3Qx2yftLNKkjUol7ZI693FLltL0
+jiPStcB4YQbbtfywUIp9Qv9QP56Fym5DljaolGvBJ7wrAgMBAAGjUTBPMAwGA1Ud
+EwEB/wQCMAAwCwYDVR0PBAQDAgXgMDIGA1UdEQQrMCmCCWxvY2FsaG9zdIcEfwAA
+AYcQAAAAAAAAAAAAAAAAAAAAAYcEwKh/ATANBgkqhkiG9w0BAQsFAAOBgQA0Gtoc
+KKpnEsVxg89MlhFJw/H8DirfVTew2fXq65POBb42aku8yfBRwvhu+EkNO9qqDwGt
+NGBB/uJ2f4cpWX1T3rXLlTU9vX8+9sIHU7jAVz1Kkev/R2iXQBDM9lDMOde8fh7P
+x6vmcnKAGyQN4O1vOIl07K90dpZJ+QLL5SbhDA==
+-----END CERTIFICATE-----
diff --git a/server/tests/pki/server-key.pem b/server/tests/pki/server-key.pem
new file mode 100644
index 0000000..099e7e0
--- /dev/null
+++ b/server/tests/pki/server-key.pem
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXAIBAAKBgQC+xjnTqasduk0gP5UAjgHDxmeploQrUVFWll5/gCnZsjUOO+4q
+EmNrEr08mAKHToThyaPVF0CfUOdugOKxoswhWeAHU19eI9B39Vd0Mdsn7SzSpI1K
+Je2SOvdxS5bS9I4j0rXAeGEG27X8sFCKfUL/UD+ehcpuQ5Y2qJRrwSe8KwIDAQAB
+AoGAbC0nGTi6iS7dEQ48xYXAxmy411c8NvvzbW/ywcXA9Wqx3xJoqH6o1UxY9gUU
+WflSLF4Ugn6e7DgKI4T+BtBTgxMLgmPxn3pjCXLUlrh7F2Zw8YSVaEARc863kmK6
+BZElhmzZ4UzT5WCQhKMnxeCOGaoUuv6+0/epKc4vCCpU2bECQQDl1XtB9x0fwNMu
+o+PFAE71AfXjFLI8KSe1lp43zOXRzobOL9noYFyVgoaAoGguAAmz69w412LH9Hac
+aigGaYzlAkEA1H5Z3dL6hCkwNJ5A4VhVfmnFT0bSwrI+kc9QBgWw7wixNoF6HWSb
+FpYu3MIiVby1tZQiR0KwENWj1e5YACWjzwJBAJbkkNbfOZTGUR/246xMJop+7gNX
+bClJT9PNfjTeZihX8nNeQS9qTH6wQkQijCNfTP9+I4iCCE2E93Z7z6leFO0CQC3r
+3Fnu5Uq4Z/2HEbhhUaCPFR/ry1JeGN2D8uRKSJFvzHReCNjfTBDWhewZXDgxHwfN
+qpbB17Dbqptp9cSaXcsCQCxo3iKueTczYZN3bcDoxSwDLr3wSs9UJ0J7wpx+gW5y
+bsHXBmjDAPU47ivjjq1PqV2UtmmWep8UDImjuXiU5Wc=
+-----END RSA PRIVATE KEY-----
diff --git a/server/tests/test-leaks.c b/server/tests/test-leaks.c
index c9bc996..8ab8e15 100644
--- a/server/tests/test-leaks.c
+++ b/server/tests/test-leaks.c
@@ -22,6 +22,8 @@
#include "basic-event-loop.h"
#include "test-display-base.h"
+#define PKI_DIR SPICE_TOP_SRCDIR "/server/tests/pki/"
+
static void server_leaks(void)
{
int result;
@@ -33,6 +35,13 @@ static void server_leaks(void)
core = basic_event_loop_init();
g_assert_nonnull(core);
+ result = spice_server_set_tls(server, 5913,
+ PKI_DIR "ca-cert.pem",
+ PKI_DIR "server-cert.pem",
+ PKI_DIR "server-key.pem",
+ NULL, NULL, NULL);
+ g_assert_cmpint(result, ==, 0);
+
g_assert_cmpint(spice_server_init(server, core), ==, 0);
/* cause the allocation of spice name */
--
2.9.3
More information about the Spice-devel
mailing list