Skip to content

macOS Linux divergence on formating nan #42

@JustinMeimar

Description

@JustinMeimar
          I tried running the current Gazprea Solution on my mac. Initially, I got a lot of errors. The following tester patch fixes most of the errors:
diff --git a/src/toolchain/Command.cpp b/src/toolchain/Command.cpp
index e6cfc2a..7e12686 100644
--- a/src/toolchain/Command.cpp
+++ b/src/toolchain/Command.cpp
@@ -353,6 +353,10 @@ std::string stripLibraryName(const std::string& filename) {
   if (pos != std::string::npos) {
     result = result.substr(0, pos);
   }
+  pos = result.find(".dylib");
+  if (pos != std::string::npos) {
+    result = result.substr(0, pos);
+  }
   return result;
 }

When I ran the tests with the patched tester I saw 1 error:

quinnpham@Quinns-MacBook-Pro tests % tester -vv --debug-package=testfiles/regression_tests/reals/ llcConfig.json
Test Information:

Package: debugPkg (1 subpackages)
 - Subpackage: debugSubPackage (1 tests)
Total Packages: 1


Testing executable: solution -> "../bin/gazc"
With toolchain: gazprea-llc -> [gazprea, llc, clang, run]
Entering package: debugPkg
  Entering subpackage: debugSubPackage
----- TestFile: "inf.test"
procedure main() returns integer {
    real x = 19E56;
    real y = 87E45;

    x -> std_output;
    '\n' -> std_output;

    y -> std_output;
    '\n' -> std_output;

    x + y -> std_output;
    '\n' -> std_output;

    x / y -> std_output;
    '\n' -> std_output;

    x % y -> std_output;
    '\n' -> std_output;

    x - y -> std_output;
    '\n' -> std_output;

    x * y -> std_output;
    '\n' -> std_output;

    x ^ y -> std_output;
    '\n' -> std_output;

    -x -> std_output;
    '\n' -> std_output;

    +x -> std_output;
    '\n' -> std_output;

    x == y -> std_output;
    '\n' -> std_output;

    x != y -> std_output;
    '\n' -> std_output;

    x < y -> std_output;
    '\n' -> std_output;

    x > y -> std_output;
    '\n' -> std_output;

    return 0;
}

//CHECK_FILE:./inf.out
----- Expected Output (52 bytes)
inf
inf
inf
-nan
-nan
-nan
inf
inf
-inf
inf
T
F
F
F
----- Generated Output (49 bytes)
inf
inf
inf
nan
nan
nan
inf
inf
-inf
inf
T
F
F
F
-----------------------
    [FAIL] inf
  Subpackage passed 0 / 1
 Package passed 0 / 1
Toolchain passed 0 / 1

Invalid 0 / 1

quinnpham@Quinns-MacBook-Pro tests %

Originally posted by @quinnlp in #37 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions