Skip to content

Commit 788a78d

Browse files
authored
Upgrade latch to version 0.2.1 (#228)
* Extend spectest suite * Update latch and refactor tests * Update latch and refactor tests * Update latch and refactor spec test * Update latch to fix names_2 test * Update debug and prim tests * Fix spec tests * Improve github ci output * Expand test suite * Update test scripts * wip * wip * Update tests * Remove debug messages * wip debugger.test.ts * Maths * Clean latch test folder * Remove incidentally included files * Update to latch `0.2.1` * Update README.md * Hotfix timeout issue * Fix third stage test suites * Fix debugger.test.ts
1 parent cf17e8e commit 788a78d

File tree

78 files changed

+11994
-399
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+11994
-399
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ if (BUILD_EMULATOR)
6262

6363
# Set default compile flags for GCC
6464
if (CMAKE_COMPILER_IS_GNUCXX)
65-
add_compile_options(-g -v -Wall -Wextra -Wunused)
65+
add_compile_options(-g -v -Wall -Wextra -Wunused -O3)
6666
endif (CMAKE_COMPILER_IS_GNUCXX)
6767

6868
# WARDuino CLI
@@ -96,7 +96,7 @@ if (BUILD_UNITTEST)
9696

9797
# Set default compile flags for GCC
9898
if (CMAKE_COMPILER_IS_GNUCXX)
99-
add_compile_options(-g -v -Wall -Wextra -Wunused)
99+
add_compile_options(-g -v -Wall -Wextra -Wunused -O3)
100100
endif (CMAKE_COMPILER_IS_GNUCXX)
101101

102102

src/Debug/debugger.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ bool Debugger::checkDebugMessages(Module *m, RunningState *program_state) {
167167
fflush(stdout);
168168
return false;
169169
}
170-
printf("received interrupt %x\n", *interruptData);
170+
debug("received interrupt %x\n", *interruptData);
171171
fflush(stdout);
172172

173173
this->channel->write("Interrupt: %x\n", *interruptData);
@@ -286,7 +286,7 @@ bool Debugger::checkDebugMessages(Module *m, RunningState *program_state) {
286286
free(interruptData);
287287
} break;
288288
case interruptMonitorProxies: {
289-
printf("receiving functions list to proxy\n");
289+
debug("receiving functions list to proxy\n");
290290
this->handleMonitorProxies(m, interruptData + 1);
291291
free(interruptData);
292292
} break;
@@ -297,7 +297,7 @@ bool Debugger::checkDebugMessages(Module *m, RunningState *program_state) {
297297
break;
298298
}
299299
case interruptDUMPAllEvents:
300-
printf("InterruptDUMPEvents\n");
300+
debug("InterruptDUMPEvents\n");
301301
size = (long)CallbackHandler::event_count();
302302
case interruptDUMPEvents:
303303
// TODO get start and size from message
@@ -700,7 +700,7 @@ void Debugger::notifyPushedEvent() const {
700700
bool Debugger::handlePushedEvent(char *bytes) const {
701701
if (*bytes != interruptPUSHEvent) return false;
702702
auto parsed = nlohmann::json::parse(bytes + 1);
703-
printf("handle pushed event: %s\n", bytes + 1);
703+
debug("handle pushed event: %s\n", bytes + 1);
704704
auto *event = new Event(*parsed.find("topic"), *parsed.find("payload"));
705705
CallbackHandler::push_event(event);
706706
this->notifyPushedEvent();
@@ -1217,12 +1217,12 @@ bool Debugger::isProxied(uint32_t fidx) const {
12171217

12181218
void Debugger::handleMonitorProxies(Module *m, uint8_t *interruptData) {
12191219
uint32_t amount_funcs = read_B32(&interruptData);
1220-
printf("funcs_total %" PRIu32 "\n", amount_funcs);
1220+
debug("funcs_total %" PRIu32 "\n", amount_funcs);
12211221

12221222
m->warduino->debugger->supervisor->unregisterAllProxiedCalls();
12231223
for (uint32_t i = 0; i < amount_funcs; i++) {
12241224
uint32_t fidx = read_B32(&interruptData);
1225-
printf("registering fid=%" PRIu32 "\n", fidx);
1225+
debug("registering fid=%" PRIu32 "\n", fidx);
12261226
m->warduino->debugger->supervisor->registerProxiedCall(fidx);
12271227
}
12281228

@@ -1233,7 +1233,7 @@ void Debugger::startProxySupervisor(Channel *socket) {
12331233
this->connected_to_proxy = true;
12341234

12351235
this->supervisor = new ProxySupervisor(socket, this->supervisor_mutex);
1236-
printf("Connected to proxy.\n");
1236+
debug("Connected to proxy.\n");
12371237
}
12381238

12391239
bool Debugger::proxy_connected() const { return this->connected_to_proxy; }

tests/latch/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Run test with the following commands:
66
npm run spectest
77
npm run primtest
88
npm run debugtest
9+
npm run comptest
910
```
1011

1112
Make sure the EMULATOR environment variable is set when you run the tests on the emulator.

tests/latch/clean.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
mkdir -p cleaned
4+
5+
for file in /home/tom/Documents/TOPL/plugin/entire/*.asserts.wast; do
6+
base=$(basename -- "$file")
7+
base="${base%%.*}"
8+
9+
echo "copying $file and $base"
10+
11+
mkdir -p tmp
12+
cp $file tmp/
13+
cp $(dirname $file)/${base}.wast tmp/
14+
15+
ls tmp/
16+
17+
WABT=/home/tom/Documents/TOPL/plugin/WABT/build/ CORESUITE=$(realpath tmp)/ npm run spectest > output
18+
19+
while read line; do
20+
21+
if grep -q "" <<< "$line"; then
22+
echo "$line" | grep -o "(.*$" | sed "s/(/&assert_return /" >> cleaned/${base}.asserts.wast
23+
elif grep -q "" <<< "$line"; then
24+
echo "removing $line"
25+
fi
26+
done < output
27+
28+
rm -rf tmp
29+
rm output
30+
done

tests/latch/core/f64.asserts.wast

Lines changed: 864 additions & 0 deletions
Large diffs are not rendered by default.

tests/latch/core/f64.wast

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
(module
3+
(func (export "add") (param $x f64) (param $y f64) (result f64) (f64.add (local.get $x) (local.get $y)))
4+
(func (export "sub") (param $x f64) (param $y f64) (result f64) (f64.sub (local.get $x) (local.get $y)))
5+
(func (export "mul") (param $x f64) (param $y f64) (result f64) (f64.mul (local.get $x) (local.get $y)))
6+
(func (export "div") (param $x f64) (param $y f64) (result f64) (f64.div (local.get $x) (local.get $y)))
7+
(func (export "sqrt") (param $x f64) (result f64) (f64.sqrt (local.get $x)))
8+
(func (export "min") (param $x f64) (param $y f64) (result f64) (f64.min (local.get $x) (local.get $y)))
9+
(func (export "max") (param $x f64) (param $y f64) (result f64) (f64.max (local.get $x) (local.get $y)))
10+
(func (export "ceil") (param $x f64) (result f64) (f64.ceil (local.get $x)))
11+
(func (export "floor") (param $x f64) (result f64) (f64.floor (local.get $x)))
12+
(func (export "trunc") (param $x f64) (result f64) (f64.trunc (local.get $x)))
13+
(func (export "nearest") (param $x f64) (result f64) (f64.nearest (local.get $x)))
14+
)
15+

0 commit comments

Comments
 (0)