Ludovic 'Archivist' Lagouardette 1 jaar geleden
bovenliggende
commit
3caa6e43a8
7 gewijzigde bestanden met toevoegingen van 50 en 5 verwijderingen
  1. +3
    -2
      CMakeLists.txt
  2. +14
    -2
      src/molasses/generator_primitives_x86_64_linux.cpp
  3. +3
    -0
      tests/001.exp
  4. +3
    -0
      tests/002.exp
  5. +3
    -0
      tests/003.exp
  6. +7
    -0
      tests/005.exp
  7. +17
    -1
      tests/006.exp

+ 3
- 2
CMakeLists.txt Bestand weergeven

@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 3.24)
project(sugar)
# find_package(cppfront REQUIRED)
set(CMAKE_CXX_STANDARD 20)
enable_testing()
@ -33,3 +31,6 @@ add_expect_test(id003 ./tests/003.exp)
add_expect_test(id004 ./tests/004.exp)
add_expect_test(id005 ./tests/005.exp)
add_expect_test(id006 ./tests/006.exp)

+ 14
- 2
src/molasses/generator_primitives_x86_64_linux.cpp Bestand weergeven

@ -5,7 +5,7 @@ namespace molasses {
namespace unix_system {
#ifdef linux
struct syscall1 {
int64_t operator()(int64_t syscall_id, int64_t p1) const {
int64_t ret;
@ -71,6 +71,7 @@ namespace molasses {
return ret;
}
};
#endif
}
@ -317,7 +318,9 @@ namespace molasses {
) {
// TODO: handle errors
}
#ifdef linux
unix_system::syscall1{}(get<int64_t>(value_0), get<int64_t>(value_1));
#endif
}
)
);
@ -344,7 +347,9 @@ namespace molasses {
) {
// TODO: handle errors
}
#ifdef linux
unix_system::syscall2{}(get<int64_t>(value_0), get<int64_t>(value_1), get<int64_t>(value_2));
#endif
}
)
);
@ -374,7 +379,9 @@ namespace molasses {
) {
// TODO: handle errors
}
#ifdef linux
unix_system::syscall3{}(get<int64_t>(value_0), get<int64_t>(value_1), get<int64_t>(value_2), get<int64_t>(value_3));
#endif
}
)
);
@ -407,7 +414,9 @@ namespace molasses {
) {
// TODO: handle errors
}
#ifdef linux
unix_system::syscall4{}(get<int64_t>(value_0), get<int64_t>(value_1), get<int64_t>(value_2), get<int64_t>(value_3), get<int64_t>(value_4));
#endif
}
)
);
@ -443,7 +452,9 @@ namespace molasses {
) {
// TODO: handle errors
}
#ifdef linux
unix_system::syscall5{}(get<int64_t>(value_0), get<int64_t>(value_1), get<int64_t>(value_2), get<int64_t>(value_3), get<int64_t>(value_4), get<int64_t>(value_5));
#endif
}
)
);
@ -482,6 +493,7 @@ namespace molasses {
) {
// TODO: handle errors
}
#ifdef linux
unix_system::syscall6{}(
get<int64_t>(value_0),
get<int64_t>(value_1),
@ -491,7 +503,7 @@ namespace molasses {
get<int64_t>(value_5),
get<int64_t>(value_6)
);
#endif
}
)
);

+ 3
- 0
tests/001.exp Bestand weergeven

@ -20,6 +20,7 @@ if {$value != 0} {
abort "compiler crashed"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE tests/001/exit-with-1.mol lex parse "/tmp/sugar.generated.$BUILD_NAME" generate assemble
expect {
@ -38,6 +39,8 @@ if {$value != 0} {
abort "compiler crashed"
}
# -------------------------------------------------------------------
spawn -noecho /tmp/sugar.generated.$BUILD_NAME
expect eof
lassign [wait] pid spawnid os_error_flag value

+ 3
- 0
tests/002.exp Bestand weergeven

@ -20,6 +20,7 @@ if {$value != 0} {
abort "compiler crashed"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE tests/002/exit-with-1.mol lex parse /tmp/sugar.generated.$BUILD_NAME generate assemble
expect {
@ -38,6 +39,8 @@ if {$value != 0} {
abort "compiler crashed"
}
# -------------------------------------------------------------------
spawn -noecho /tmp/sugar.generated.$BUILD_NAME
expect eof
lassign [wait] pid spawnid os_error_flag value

+ 3
- 0
tests/003.exp Bestand weergeven

@ -25,6 +25,7 @@ if {$value != 0} {
abort "compiler crashed"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE tests/003/exit-with-1.mol lex tests/003/library.mol lex merge parse /tmp/sugar.generated.$BUILD_NAME generate assemble
expect {
@ -43,6 +44,8 @@ if {$value != 0} {
abort "compiler crashed"
}
# -------------------------------------------------------------------
spawn -noecho /tmp/sugar.generated.$BUILD_NAME
expect {
error { abort "failed to compile" }

+ 7
- 0
tests/005.exp Bestand weergeven

@ -20,6 +20,8 @@ if {$value != 0} {
abort "compiler crashed"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE tests/005/exit-with-3.mol tests/005/library.mol lex-all merge-all parse
expect {
error { abort "failed to parse" }
@ -32,6 +34,8 @@ if {$value != 0} {
abort "compiler crashed"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE tests/005/exit-with-3.mol tests/005/library.mol lex-all merge-all parse
expect {
error { abort "failed to parse" }
@ -44,6 +48,7 @@ if {$value != 0} {
abort "compiler crashed"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE tests/005/exit-with-3.mol lex tests/005/library.mol lex merge parse /tmp/sugar.generated.$BUILD_NAME generate assemble
expect {
@ -62,6 +67,8 @@ if {$value != 0} {
abort "compiler crashed"
}
# -------------------------------------------------------------------
spawn -noecho /tmp/sugar.generated.$BUILD_NAME
expect {
error { abort "failed to compile" }

+ 17
- 1
tests/006.exp Bestand weergeven

@ -1,7 +1,7 @@
#!/usr/bin/expect
set SUGAR_EXECUTABLE $::env(SUGAR_EXECUTABLE)
set BUILD_NAME 005.
set BUILD_NAME 006.
proc abort {reason} {
puts "test failed $reason"
@ -20,6 +20,8 @@ if {$value == 0} {
abort "compiler didn't crash"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE "fake_01.006.not_a_file" lex
expect {
error { abort "failed to parse" }
@ -32,6 +34,8 @@ if {$value == 0} {
abort "compiler didn't crash"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE "fake_01.006.not_a_file" lex-all
expect {
error { abort "failed to parse" }
@ -44,6 +48,8 @@ if {$value == 0} {
abort "compiler didn't crash"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE "tests/005/library.mol" lex merge
expect {
error { abort "failed to parse" }
@ -56,6 +62,8 @@ if {$value == 0} {
abort "compiler didn't crash"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE merge
expect {
error { abort "failed to parse" }
@ -68,6 +76,8 @@ if {$value == 0} {
abort "compiler didn't crash"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE parse
expect {
error { abort "failed to parse" }
@ -109,6 +119,8 @@ if {[file exists "/tmp/006.fake_target"]} {
file delete "/tmp/006.fake_target"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE merge-all
expect {
error { abort "failed to parse" }
@ -133,6 +145,8 @@ if {$value == 0} {
abort "compiler didn't crash"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE help
expect {
error { abort "failed to parse" }
@ -145,6 +159,8 @@ if {$value != 0} {
abort "compiler crashed displaying help"
}
# -------------------------------------------------------------------
spawn -noecho $SUGAR_EXECUTABLE --help
expect {
error { abort "failed to parse" }

Laden…
Annuleren
Opslaan