aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-13 00:00:47 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-13 00:00:47 -0800
commitb639e4d3643b8245b77bc8707a3a864221fad195 (patch)
treeaa21c05f7ce8a1fd388b1eb1189e38e66f79e068 /tests
parent2bb6a23037656474a90d869c5147b32bae1a2e40 (diff)
downloadnng-b639e4d3643b8245b77bc8707a3a864221fad195.tar.gz
nng-b639e4d3643b8245b77bc8707a3a864221fad195.tar.bz2
nng-b639e4d3643b8245b77bc8707a3a864221fad195.zip
Many fixes for Windows. It compiles, and some tests work.
Windows is getting there. Needs a couple of more more hours to enable everything, especially IPC, and most of the work at this point is probably some combination of debug and tweaking things like error handling.
Diffstat (limited to 'tests')
-rw-r--r--tests/platform.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/tests/platform.c b/tests/platform.c
index d408959c..7bf1d0d1 100644
--- a/tests/platform.c
+++ b/tests/platform.c
@@ -110,16 +110,14 @@ TestMain("Platform Operations", {
Convey("We can lock a mutex", {
nni_mtx_lock(&mx);
So(1);
- Convey("And cannot recursively lock", {
- rv = nni_mtx_trylock(&mx);
- So(rv != 0);
- })
Convey("And we can unlock it", {
nni_mtx_unlock(&mx);
So(1);
Convey("And then lock it again", {
- rv = nni_mtx_trylock(&mx);
- So(rv == 0);
+ nni_mtx_lock(&mx);
+ So(1);
+ nni_mtx_unlock(&mx);
+ So(1);
})
})
})
@@ -138,16 +136,13 @@ TestMain("Platform Operations", {
So(rv == 0);
nni_thr_run(&thr);
+ Reset({
+ nni_thr_fini(&thr);
+ })
+
Convey("It ran", {
nni_usleep(50000); // for context switch
So(val == 1);
- nni_thr_fini(&thr);
- })
- Convey("We can reap it", {
- nni_thr_fini(&thr);
- })
- Reset({
- nni_thr_fini(&thr);
})
})
})
@@ -162,6 +157,7 @@ TestMain("Platform Operations", {
Reset({
nni_cv_fini(&arg.cv);
nni_mtx_fini(&arg.mx);
+ nni_thr_fini(&thr);
});
Convey("Notification works", {
@@ -174,7 +170,7 @@ TestMain("Platform Operations", {
nni_cv_wait(&arg.cv);
}
nni_mtx_unlock(&arg.mx);
- nni_thr_fini(&thr);
+ nni_thr_wait(&thr);
So(arg.did == 1);
})
@@ -188,7 +184,7 @@ TestMain("Platform Operations", {
}
So(arg.did == 0);
nni_mtx_unlock(&arg.mx);
- nni_thr_fini(&thr);
+ nni_thr_wait(&thr);
})
Convey("Not running works", {
@@ -200,11 +196,6 @@ TestMain("Platform Operations", {
}
So(arg.did == 0);
nni_mtx_unlock(&arg.mx);
- nni_thr_fini(&thr);
- })
-
- Reset({
- nni_thr_fini(&thr);
})
})
})