lua-language-server: fix build on ppc* and probably somewhere else

I don't see why this bundles bee.lua three times, but okay (that
is why the fixes are duplicated three times)

In any case, fixes two things:

1) bee.lua implements a custom spinlock (why???) which needs a
   cpu_relax, which was unimplemented on ppc* so fill that in
2) at some point this random test was added, which I do not see
   what it is supposed to accomplish, since Lua does not guarantee
   order of iteration in a table in any way, so technically this
   should fail in most cases (the tests are run on every build,
   why does it not fail on x86?) - the commit message is literally
   just "add a test" in chinese, so it is not particularly helpful
This commit is contained in:
q66 2022-07-24 21:50:04 +02:00
parent 751e1ae236
commit be24bac5ac
2 changed files with 127 additions and 0 deletions

View File

@ -0,0 +1,82 @@
commit 59f1baf712f50873af54148cb2a3f379ce796353
Author: q66 <daniel@octaforge.org>
Date: Sun Jul 24 21:34:59 2022 +0200
remove stupid broken tests
I don't even know what the purpose of this is supposed to be,
considering lua does not guarantee iteration order in a hash
table in any way, and it comes out different on every run.
diff --git a/3rd/bee.lua/test/test_lua.lua b/3rd/bee.lua/test/test_lua.lua
index 5b85af7..cf653c0 100644
--- a/3rd/bee.lua/test/test_lua.lua
+++ b/3rd/bee.lua/test/test_lua.lua
@@ -21,19 +21,4 @@ function test_lua:test_stack_overflow_2()
end
function test_lua:test_next()
- local t = {}
- for i = 1, 26 do
- t[string.char(0x40+i)] = true
- end
- local expected = {
- 'Z', 'Y', 'V', 'U', 'X', 'W', 'R', 'Q', 'T', 'S', 'N', 'M', 'P', 'O', 'J', 'I', 'L', 'K', 'F', 'E', 'H', 'G', 'B', 'A', 'D', 'C'
- }
- local function checkOK()
- local key
- for i = 1, 26 do
- key = next(t, key)
- lt.assertEquals(key, expected[i])
- end
- end
- checkOK()
end
diff --git a/3rd/luamake/3rd/bee.lua/test/test_lua.lua b/3rd/luamake/3rd/bee.lua/test/test_lua.lua
index 5b85af7..cf653c0 100644
--- a/3rd/luamake/3rd/bee.lua/test/test_lua.lua
+++ b/3rd/luamake/3rd/bee.lua/test/test_lua.lua
@@ -21,19 +21,4 @@ function test_lua:test_stack_overflow_2()
end
function test_lua:test_next()
- local t = {}
- for i = 1, 26 do
- t[string.char(0x40+i)] = true
- end
- local expected = {
- 'Z', 'Y', 'V', 'U', 'X', 'W', 'R', 'Q', 'T', 'S', 'N', 'M', 'P', 'O', 'J', 'I', 'L', 'K', 'F', 'E', 'H', 'G', 'B', 'A', 'D', 'C'
- }
- local function checkOK()
- local key
- for i = 1, 26 do
- key = next(t, key)
- lt.assertEquals(key, expected[i])
- end
- end
- checkOK()
end
diff --git a/luamake/3rd/bee.lua/test/test_lua.lua b/luamake/3rd/bee.lua/test/test_lua.lua
index 5b85af7..cf653c0 100644
--- a/luamake/3rd/bee.lua/test/test_lua.lua
+++ b/luamake/3rd/bee.lua/test/test_lua.lua
@@ -21,19 +21,4 @@ function test_lua:test_stack_overflow_2()
end
function test_lua:test_next()
- local t = {}
- for i = 1, 26 do
- t[string.char(0x40+i)] = true
- end
- local expected = {
- 'Z', 'Y', 'V', 'U', 'X', 'W', 'R', 'Q', 'T', 'S', 'N', 'M', 'P', 'O', 'J', 'I', 'L', 'K', 'F', 'E', 'H', 'G', 'B', 'A', 'D', 'C'
- }
- local function checkOK()
- local key
- for i = 1, 26 do
- key = next(t, key)
- lt.assertEquals(key, expected[i])
- end
- end
- checkOK()
end

View File

@ -0,0 +1,45 @@
commit ffb877fd6ac8b004f3263e284b584d778fd681e5
Author: q66 <daniel@octaforge.org>
Date: Sun Jul 24 21:10:55 2022 +0200
fix build on ppc*
diff --git a/3rd/bee.lua/bee/thread/spinlock.h b/3rd/bee.lua/bee/thread/spinlock.h
index ad0cf4e..f4c2f22 100644
--- a/3rd/bee.lua/bee/thread/spinlock.h
+++ b/3rd/bee.lua/bee/thread/spinlock.h
@@ -18,6 +18,8 @@
asm volatile ("div %0, %0, zero" : "=r" (dummy));
asm volatile ("" ::: "memory");
}}
+#elif defined(__powerpc__)
+ namespace bee { inline void cpu_relax() { asm volatile ("or 27,27,27" ::: "memory"); }}
#else
#error unsupport platform
#endif
diff --git a/3rd/luamake/3rd/bee.lua/bee/thread/spinlock.h b/3rd/luamake/3rd/bee.lua/bee/thread/spinlock.h
index ad0cf4e..f4c2f22 100644
--- a/3rd/luamake/3rd/bee.lua/bee/thread/spinlock.h
+++ b/3rd/luamake/3rd/bee.lua/bee/thread/spinlock.h
@@ -18,6 +18,8 @@
asm volatile ("div %0, %0, zero" : "=r" (dummy));
asm volatile ("" ::: "memory");
}}
+#elif defined(__powerpc__)
+ namespace bee { inline void cpu_relax() { asm volatile ("or 27,27,27" ::: "memory"); }}
#else
#error unsupport platform
#endif
diff --git a/luamake/3rd/bee.lua/bee/thread/spinlock.h b/luamake/3rd/bee.lua/bee/thread/spinlock.h
index ad0cf4e..f4c2f22 100644
--- a/luamake/3rd/bee.lua/bee/thread/spinlock.h
+++ b/luamake/3rd/bee.lua/bee/thread/spinlock.h
@@ -18,6 +18,8 @@
asm volatile ("div %0, %0, zero" : "=r" (dummy));
asm volatile ("" ::: "memory");
}}
+#elif defined(__powerpc__)
+ namespace bee { inline void cpu_relax() { asm volatile ("or 27,27,27" ::: "memory"); }}
#else
#error unsupport platform
#endif