From f5a1b3343f0fdfc7d0bce48a8412fac7582080d0 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Fri, 9 Nov 2018 16:57:43 -0500 Subject: [PATCH 1/7] removes .d --- .d/.gitignore | 1 - .d/jets/a/.gitignore | 0 .d/jets/b/.gitignore | 0 .d/jets/c/.gitignore | 0 .d/jets/d/.gitignore | 0 .d/jets/e/.gitignore | 0 .d/jets/f/.gitignore | 0 .d/jets/g/.gitignore | 0 .d/noun/.gitignore | 0 .d/outside/jhttp/.gitignore | 0 .d/outside/murmur3/.gitignore | 0 .d/tests/.gitignore | 0 .d/vere/.gitignore | 0 13 files changed, 1 deletion(-) delete mode 100644 .d/.gitignore delete mode 100644 .d/jets/a/.gitignore delete mode 100644 .d/jets/b/.gitignore delete mode 100644 .d/jets/c/.gitignore delete mode 100644 .d/jets/d/.gitignore delete mode 100644 .d/jets/e/.gitignore delete mode 100644 .d/jets/f/.gitignore delete mode 100644 .d/jets/g/.gitignore delete mode 100644 .d/noun/.gitignore delete mode 100644 .d/outside/jhttp/.gitignore delete mode 100644 .d/outside/murmur3/.gitignore delete mode 100644 .d/tests/.gitignore delete mode 100644 .d/vere/.gitignore diff --git a/.d/.gitignore b/.d/.gitignore deleted file mode 100644 index 21af5d669d..0000000000 --- a/.d/.gitignore +++ /dev/null @@ -1 +0,0 @@ -**.d diff --git a/.d/jets/a/.gitignore b/.d/jets/a/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.d/jets/b/.gitignore b/.d/jets/b/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.d/jets/c/.gitignore b/.d/jets/c/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.d/jets/d/.gitignore b/.d/jets/d/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.d/jets/e/.gitignore b/.d/jets/e/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.d/jets/f/.gitignore b/.d/jets/f/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.d/jets/g/.gitignore b/.d/jets/g/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.d/noun/.gitignore b/.d/noun/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.d/outside/jhttp/.gitignore b/.d/outside/jhttp/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.d/outside/murmur3/.gitignore b/.d/outside/murmur3/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.d/tests/.gitignore b/.d/tests/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.d/vere/.gitignore b/.d/vere/.gitignore deleted file mode 100644 index e69de29bb2..0000000000 From 5c4ccdef413c3fcbf2fcb4a0621133a7ef9c10af Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Tue, 13 Nov 2018 13:12:49 -0500 Subject: [PATCH 2/7] configures/builds/activates hashtable tests --- meson.build | 56 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index 4cefeff2ff..4f8ffd0b89 100644 --- a/meson.build +++ b/meson.build @@ -218,6 +218,15 @@ jets_g_src = [ jets_src = [ 'jets/tree.c' ] + +jets_all_src = [ + jets_a_src, jets_b_src, + jets_c_src, jets_d_src, + jets_e_src, jets_e_ed_src, + jets_f_src, jets_f_ut_src, + jets_z_src, jets_z_ut_src, + jets_g_src, jets_src] + noun_src = ['noun/allocate.c', 'noun/events.c', 'noun/hashtable.c', @@ -246,14 +255,7 @@ vere_src = ['vere/ames.c', 'vere/unix.c', 'vere/walk.c'] -src_list = [ -vere_src, noun_src, -jets_a_src, jets_b_src, -jets_c_src, jets_d_src, -jets_e_src, jets_e_ed_src, -jets_f_src, jets_f_ut_src, -jets_z_src, jets_z_ut_src, -jets_g_src, jets_src] +src_list = [vere_src, noun_src, jets_all_src] sources = [] foreach s : src_list @@ -369,3 +371,41 @@ dependencies: [openssl_dep, softfloat3_dep, libsni_dep] + os_deps, install: true) + +vere_sans_main = ['vere/ames.c', + 'vere/behn.c', + 'vere/cttp.c', + 'vere/http.c', + 'vere/loop.c', + 'vere/raft.c', + 'vere/reck.c', + 'vere/save.c', + 'vere/sist.c', + 'vere/term.c', + 'vere/time.c', + 'vere/unix.c', + 'vere/walk.c'] + +# XX shrink this list +test_sources = noun_src + jets_all_src + vere_sans_main + +test_hashtable = executable('test-hashtable', +sources : test_sources + ['tests/hashtable_tests.c'], +include_directories : incdir, +c_args : os_c_flags, +link_args: os_link_flags, +dependencies: [openssl_dep, + curl_dep, + libuv_dep, + libh2o_dep, + cmark_dep, + gmp_dep, + sigsegv_dep, + urbitscrypt_dep, + ed25519_dep, + murmur3_dep, + softfloat3_dep, + libsni_dep] + os_deps, +install: false) + +test('test-hashtable', test_hashtable) From fc665dce04103148e7985441c366b3d9700183da Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Tue, 13 Nov 2018 13:42:15 -0500 Subject: [PATCH 3/7] configures/builds/activates (failing) memory tests --- meson.build | 23 ++++++++++++ tests/test.c | 99 ++++++++++++++++++++++++++-------------------------- 2 files changed, 73 insertions(+), 49 deletions(-) diff --git a/meson.build b/meson.build index 4f8ffd0b89..566798b880 100644 --- a/meson.build +++ b/meson.build @@ -409,3 +409,26 @@ dependencies: [openssl_dep, install: false) test('test-hashtable', test_hashtable) + +test_mem_sources = noun_src + jets_all_src + vere_sans_main + ['tests/test.c'] + +test_mem = executable('test-mem', +sources : test_sources + ['tests/test.c'], +include_directories : incdir, +c_args : os_c_flags, +link_args: os_link_flags, +dependencies: [openssl_dep, + curl_dep, + libuv_dep, + libh2o_dep, + cmark_dep, + gmp_dep, + sigsegv_dep, + urbitscrypt_dep, + ed25519_dep, + murmur3_dep, + softfloat3_dep, + libsni_dep] + os_deps, +install: false) + +test('test-mem', test_mem, should_fail: true) diff --git a/tests/test.c b/tests/test.c index 48a78b18e1..4a7eb12abf 100644 --- a/tests/test.c +++ b/tests/test.c @@ -34,7 +34,7 @@ u3_walk_load(c3_c* pas_c) if ( (fid_i < 0) || (fstat(fid_i, &buf_b) < 0) ) { fprintf(stderr, "%s: %s\r\n", pas_c, strerror(errno)); - return u3_cm_bail(c3__fail); + return u3m_bail(c3__fail); } fln_w = buf_b.st_size; pad_y = c3_malloc(buf_b.st_size); @@ -44,10 +44,10 @@ u3_walk_load(c3_c* pas_c) if ( fln_w != red_w ) { free(pad_y); - return u3_cm_bail(c3__fail); + return u3m_bail(c3__fail); } else { - u3_noun pad = u3_ci_bytes(fln_w, (c3_y *)pad_y); + u3_noun pad = u3i_bytes(fln_w, (c3_y *)pad_y); free(pad_y); return pad; @@ -59,14 +59,14 @@ u3_walk_load(c3_c* pas_c) static c3_w* _test_walloc(c3_w siz_w) { - c3_w *ptr_w = u3_ca_walloc(siz_w); + c3_w *ptr_w = u3a_walloc(siz_w); c3_w i_w; c3_assert(siz_w >= 1); *ptr_w = siz_w; for ( i_w = 1; i_w < siz_w; i_w++ ) { - ptr_w[i_w] = u3_cr_mug((0xffff & (c3_p)(ptr_w)) + i_w); + ptr_w[i_w] = u3r_mug((0xffff & (c3_p)(ptr_w)) + i_w); } return ptr_w; } @@ -77,9 +77,9 @@ _test_free(c3_w* ptr_w) c3_w i_w, siz_w = *ptr_w; for ( i_w = 1; i_w < siz_w; i_w++ ) { - c3_assert(ptr_w[i_w] == u3_cr_mug((0xffff & (c3_p)(ptr_w)) + i_w)); + c3_assert(ptr_w[i_w] == u3r_mug((0xffff & (c3_p)(ptr_w)) + i_w)); } - u3_ca_free(ptr_w); + u3a_free(ptr_w); } #define NUM 16384 @@ -94,7 +94,7 @@ test(void) c3_w i_w; for ( i_w = 0; i_w < NUM; i_w++ ) { - c3_w siz_w = c3_max(1, u3_cr_mug(i_w) & 0xff); + c3_w siz_w = c3_max(1, u3r_mug(i_w) & 0xff); one_w[i_w] = _test_walloc(siz_w); two_w[i_w] = _test_walloc(siz_w); @@ -106,7 +106,7 @@ test(void) _road_sane(); } for ( i_w = 0; i_w < NUM; i_w++ ) { - c3_w siz_w = c3_max(1, u3_cr_mug(i_w + 1) & 0xff); + c3_w siz_w = c3_max(1, u3r_mug(i_w + 1) & 0xff); two_w[i_w] = _test_walloc(siz_w); _road_sane(); @@ -117,7 +117,7 @@ test(void) _road_sane(); } for ( i_w = 0; i_w < NUM; i_w++ ) { - c3_w siz_w = c3_max(1, u3_cr_mug(i_w + 2) & 0xff); + c3_w siz_w = c3_max(1, u3r_mug(i_w + 2) & 0xff); one_w[i_w] = _test_walloc(siz_w); _road_sane(); @@ -140,21 +140,21 @@ test(void) static void _test_hash(void) { - u3_cm_dump(); + // u3m_dump(); { - u3_ch_root* har_u = u3_ch_new(); + u3h_root* har_u = u3h_new(); c3_w i_w; c3_w max_w = (1 << 20); for ( i_w = 0; i_w < max_w; i_w++ ) { u3_noun key = u3nc(0, i_w); - u3_ch_put(har_u, key, (i_w + 1)); + u3h_put(har_u, key, (i_w + 1)); u3z(key); } for ( i_w = 0; i_w < max_w; i_w++ ) { u3_noun key = u3nc(0, i_w); - u3_noun val = u3_ch_get(har_u, key); + u3_noun val = u3h_get(har_u, key); if ( val != (i_w + 1) ) { if ( u3_none == val ) { @@ -165,9 +165,9 @@ _test_hash(void) } u3z(key); } - u3_ch_free(har_u); + u3h_free(har_u); } - u3_cm_dump(); + // u3m_dump(); } #endif @@ -175,25 +175,25 @@ _test_hash(void) static void _test_jam(void) { - u3_cm_dump(); + // u3m_dump(); { u3_noun pil = u3_walk_load("urb/urbit.pill"); u3_noun cue, jam; - printf("cueing pill - %d bytes\n", u3_cr_met(3, pil)); - cue = u3_cke_cue(pil); - printf("cued - mug %x\n", u3_cr_mug(cue)); + printf("cueing pill - %d bytes\n", u3r_met(3, pil)); + cue = u3ke_cue(pil); + printf("cued - mug %x\n", u3r_mug(cue)); #if 1 - jam = u3_cke_jam(cue); - printf("jammed - %d bytes\n", u3_cr_met(3, jam)); - cue = u3_cke_cue(jam); - printf("cued - mug %x\n", u3_cr_mug(cue)); + jam = u3ke_jam(cue); + printf("jammed - %d bytes\n", u3r_met(3, jam)); + cue = u3ke_cue(jam); + printf("cued - mug %x\n", u3r_mug(cue)); #endif u3z(cue); } - u3_cm_dump(); + // u3m_dump(); } #endif @@ -201,45 +201,45 @@ static void _test_leap(void) { #if 1 - u3_cm_dump(); + // u3m_dump(); { u3_noun pil; u3_noun cue, jam; - c3_w gof_w = u3_cm_golf(); + c3_w gof_w = u3m_golf(); pil = u3_walk_load("urb/urbit.pill"); - u3_cm_leap(0); - printf("cueing pill - %d bytes\n", u3_cr_met(3, pil)); - cue = u3_cke_cue(pil); - printf("cued - %p, mug %x\n", u3_co_to_ptr(cue), u3_cr_mug(cue)); - u3_cm_fall(); + u3m_leap(0); + printf("cueing pill - %d bytes\n", u3r_met(3, pil)); + cue = u3ke_cue(pil); + printf("cued - %p, mug %x\n", u3a_to_ptr(cue), u3r_mug(cue)); + u3m_fall(); - cue = u3_ca_take(cue); - printf("taken - %p, mug %x\n", u3_co_to_ptr(cue), u3_cr_mug(cue)); - u3_cm_flog(gof_w); + cue = u3a_take(cue); + printf("taken - %p, mug %x\n", u3a_to_ptr(cue), u3r_mug(cue)); + u3m_flog(gof_w); u3z(pil); #if 1 - jam = u3_cke_jam(cue); - printf("jammed - %d bytes\n", u3_cr_met(3, jam)); - cue = u3_cke_cue(jam); - printf("cued - mug %x\n", u3_cr_mug(cue)); + jam = u3ke_jam(cue); + printf("jammed - %d bytes\n", u3r_met(3, jam)); + cue = u3ke_cue(jam); + printf("cued - mug %x\n", u3r_mug(cue)); #endif u3z(cue); } - u3_cm_dump(); + // u3m_dump(); #endif } static void _test_test(void) { - u3_noun fol = u3_cke_cue(u3_walk_load("pill/west.pill")); + u3_noun fol = u3ke_cue(u3_walk_load("pill/west.pill")); u3_noun val; - printf("test_test: formula mug %x\n", u3_cr_mug(fol)); - val = u3_cn_nock_on(u3nc(42, 17), fol); + printf("test_test: formula mug %x\n", u3r_mug(fol)); + val = u3n_nock_on(u3nc(42, 17), fol); printf("val %d\n", val); u3z(val); } @@ -254,11 +254,11 @@ main(int argc, char *argv[]) printf("hello, world: len %dMB\n", (1 << U3_OS_LoomBits) >> 18); // _test_words(); - u3_ce_init(u3_no); - u3_cm_boot(u3_yes); - // u3_cj_boot(); + u3m_init(c3n); + u3m_pave(c3y, c3n); + // u3j_boot(); - // u3_cm_dump(); + // u3m_dump(); printf("booted.\n"); @@ -267,6 +267,7 @@ main(int argc, char *argv[]) // _test_hash(); // _test_jam(); } - u3_cm_clear(); - // u3_cm_dump(); + // u3m_clear(); + + // u3m_dump(); } From 19e588e503d80c9042cd0fae8923be5caedbcc42 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Tue, 13 Nov 2018 13:43:15 -0500 Subject: [PATCH 4/7] removes old kjet implementation file --- tests/kjet.c | 67 ---------------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 tests/kjet.c diff --git a/tests/kjet.c b/tests/kjet.c deleted file mode 100644 index 8803ad5b83..0000000000 --- a/tests/kjet.c +++ /dev/null @@ -1,67 +0,0 @@ -/* f/meme.c -** -*/ -#include "f/meme.h" - - /* u3_cka_sub(): a + b. - */ - /* u3_cka_gth(): a + b. - */ - - /* u3_cka_mul(): a * b. - */ - /* u3_cka_lte(): a * b. - */ - - /* u3_ckb_lent(): length of list `a`. - */ - /* u3_ckb_flop(): reverse list `a`. - */ - /* u3_ckb_weld(): concatenate lists `a` before `b`. - */ - /* u3_ckc_lsh(): left shift. - */ - /* u3_ckc_rsh(): right shift. - */ - /* u3_ckdb_get(): map get for key `b` in map `a` with u3_none. - */ - u3_weak - u3_ckdb_get(u3_noun a, u3_noun b) - { - u3_noun c = u3_cqdb_get(a, b); - - u3z(a); u3z(b); - if ( u3_no == u3_cr_du(c) ) { - u3z(c); - return u3_none; - } else { - u3_noun pro = u3k(u3t(c)); - - u3z(c); - return pro; - } - } - - /* u3_ckdb_got(): map get for key `b` in map `a` with fail. - */ - /* u3_ckdb_put(): map put for key `b`, value `c` in map `a`. - */ - /* u3_ckdb_gas(): list to map. - */ - /* u3_ckdi_gas(): list to map. - */ - - /* u3_ckdb_has(): test for presence. - */ - /* u3_ckdi_has(): test for presence. - */ - /* u3_ckdi_tap(): map/set convert to list. (solves by_tap also.) - */ - - /* u3_cke_cue(): expand saved pill. - */ - - /* u3_cke_jam(): pack noun as atom. - */ - /* u3_cke_trip(): atom to tape. - */ From c9e22d93053b5f82b05aa7887521d7b20c30fb36 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Tue, 13 Nov 2018 13:44:21 -0500 Subject: [PATCH 5/7] [CI] run tests --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a21184c22f..d3170289dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ script: - meson . ./build --buildtype=debugoptimized -Dgc=true -Dprof=true - cd ./build - ninja + - ninja test - sudo ninja install - cd ../.travis - npm install From 10a706009120f3c48f36af5190253dd78531f776 Mon Sep 17 00:00:00 2001 From: benjamin-tlon <42358674+benjamin-tlon@users.noreply.github.com> Date: Wed, 14 Nov 2018 09:30:26 -0800 Subject: [PATCH 6/7] Make list indentation consistent in Meson file. --- meson.build | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 566798b880..ae1ac487bd 100644 --- a/meson.build +++ b/meson.build @@ -227,7 +227,8 @@ jets_all_src = [ jets_z_src, jets_z_ut_src, jets_g_src, jets_src] -noun_src = ['noun/allocate.c', +noun_src = [ + 'noun/allocate.c', 'noun/events.c', 'noun/hashtable.c', 'noun/imprison.c', @@ -240,7 +241,8 @@ noun_src = ['noun/allocate.c', 'noun/xtract.c', 'noun/zave.c'] -vere_src = ['vere/ames.c', +vere_src = [ + 'vere/ames.c', 'vere/behn.c', 'vere/cttp.c', 'vere/http.c', @@ -372,7 +374,8 @@ dependencies: [openssl_dep, libsni_dep] + os_deps, install: true) -vere_sans_main = ['vere/ames.c', +vere_sans_main = [ + 'vere/ames.c', 'vere/behn.c', 'vere/cttp.c', 'vere/http.c', From e4b259138c98c3706ad16702e9442a0db26b68ef Mon Sep 17 00:00:00 2001 From: benjamin-tlon <42358674+benjamin-tlon@users.noreply.github.com> Date: Wed, 14 Nov 2018 09:34:25 -0800 Subject: [PATCH 7/7] Minor Cleanup --- meson.build | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/meson.build b/meson.build index ae1ac487bd..220769f316 100644 --- a/meson.build +++ b/meson.build @@ -239,15 +239,15 @@ noun_src = [ 'noun/trace.c', 'noun/vortex.c', 'noun/xtract.c', - 'noun/zave.c'] + 'noun/zave.c' +] -vere_src = [ +vere_sans_main = [ 'vere/ames.c', 'vere/behn.c', 'vere/cttp.c', 'vere/http.c', 'vere/loop.c', - 'vere/main.c', 'vere/raft.c', 'vere/reck.c', 'vere/save.c', @@ -255,7 +255,10 @@ vere_src = [ 'vere/term.c', 'vere/time.c', 'vere/unix.c', - 'vere/walk.c'] + 'vere/walk.c' +] + +vere_src = vere_sans_main + [ 'vere/main.c' ] src_list = [vere_src, noun_src, jets_all_src] @@ -374,21 +377,6 @@ dependencies: [openssl_dep, libsni_dep] + os_deps, install: true) -vere_sans_main = [ - 'vere/ames.c', - 'vere/behn.c', - 'vere/cttp.c', - 'vere/http.c', - 'vere/loop.c', - 'vere/raft.c', - 'vere/reck.c', - 'vere/save.c', - 'vere/sist.c', - 'vere/term.c', - 'vere/time.c', - 'vere/unix.c', - 'vere/walk.c'] - # XX shrink this list test_sources = noun_src + jets_all_src + vere_sans_main