Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run whole test/Base_Tests with NI #10296

Merged
merged 58 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
29a0920
Try to run the whole test/Base_Tests
JaroslavTulach Jun 17, 2024
51bc321
Catch NI error
JaroslavTulach Jun 17, 2024
2aa81cd
Instance methods on Decoder and Encoder are being called
JaroslavTulach Jun 17, 2024
354808a
java.util.ArrayList is often used in tests - register it for reflection
JaroslavTulach Jun 17, 2024
20f9589
Allow access to instance methods of these classes
JaroslavTulach Jun 17, 2024
d636711
Need reflective access to AdjustOp nested class
JaroslavTulach Jun 17, 2024
c3a97c1
Need to call instance methods on LinearModel
JaroslavTulach Jun 17, 2024
d61e5d2
Need access to nested classes
JaroslavTulach Jun 17, 2024
dc38371
Put all extra files to Extra_Imports.enso
JaroslavTulach Jun 17, 2024
4a7a5df
locate enso_parser library even in ./runner mode
JaroslavTulach Jun 17, 2024
6efc514
Need to access message method
JaroslavTulach Jun 17, 2024
3f02060
Execute ./runner --run <selected file>
JaroslavTulach Jun 17, 2024
35ca49c
./runner must embed all locales
JaroslavTulach Jun 17, 2024
501c07d
Making sure more missing symbols is accesible
JaroslavTulach Jun 17, 2024
377bd2a
Replacing usage of asGuestObject in EnsoFile by own TruffleObject imp…
JaroslavTulach Jun 18, 2024
466f222
Support reading into a byte[]
JaroslavTulach Jun 18, 2024
a9cda6f
I/O needs to be hidden behind @TruffleBoundary
JaroslavTulach Jun 18, 2024
0d902b2
Cannot be loaded from "root"
JaroslavTulach Jun 18, 2024
31e3798
XML.from_file requires -1 at the end of the file
JaroslavTulach Jun 18, 2024
cae2521
Include jdk.localedata to make I18N available
JaroslavTulach Jun 18, 2024
30ce7c3
Less polyglot java imports in XML.enso
JaroslavTulach Jun 19, 2024
0695d1b
InputStreamLike interface to 'view' EnsoFile's 'java' stream as havin…
JaroslavTulach Jun 19, 2024
ec2ea1f
LocalDateTime and Function are used in Base_Tests
JaroslavTulach Jun 19, 2024
d03ba23
Add all Charsets
JaroslavTulach Jun 19, 2024
3e5e0b0
Don't need index to runEngineDistribution
JaroslavTulach Jun 20, 2024
3c52ea7
Let the Stream_Utils handle asInputStream conversion
JaroslavTulach Jun 20, 2024
07e7770
Additional imports
JaroslavTulach Jun 20, 2024
d59f6f7
Introducing File_Utils to encapsulate matcher
JaroslavTulach Jun 20, 2024
9f4569a
Avoid Python None check when Python is missing
JaroslavTulach Jun 20, 2024
b9d221f
asOutputStream wrapper
JaroslavTulach Jun 20, 2024
5328f66
Need to support available() to make Reporting_Stream_Decoder_Spec suc…
JaroslavTulach Jun 20, 2024
ec0918f
Register OutputStreamLike for reflection
JaroslavTulach Jun 20, 2024
c2f9eb5
Make HttpClient.Builder ready for reflective access
JaroslavTulach Jun 20, 2024
04bfdcd
Survive when js_exception (provided via asGuestValue) doesn't have th…
JaroslavTulach Jun 20, 2024
6ab352e
Rather call static method than Predicate.test
JaroslavTulach Jun 20, 2024
961c3ec
When XML_Document.Value is private, allocate with factory method
JaroslavTulach Jun 20, 2024
7d73811
Include org.enso.base_test_helpers on classpath when building native …
JaroslavTulach Jun 20, 2024
b222ed0
Another place to asOutputStream
JaroslavTulach Jun 20, 2024
e819e74
Calling overloaded Path.of has some issues. Use File_Utils wrapper
JaroslavTulach Jun 20, 2024
fc24808
Few more extra imports
JaroslavTulach Jun 20, 2024
0dec33e
Regenerated SubstrateVM metadata with:
JaroslavTulach Jun 20, 2024
41ef406
Search from cwd is important for development setup
JaroslavTulach Jun 20, 2024
582f3be
Relaxing the test as NI cannot provide location of the error (yet)
JaroslavTulach Jun 20, 2024
403e0d6
HttpClient.Version is being access
JaroslavTulach Jun 20, 2024
cc14d91
Manual tweaks to reflect-config.json file
JaroslavTulach Jun 20, 2024
34424ae
Have to absolutize the file path
JaroslavTulach Jun 20, 2024
71cfc0d
Avoid asGuestValue in EnsoProjectNode
JaroslavTulach Jun 20, 2024
2b9be62
Need to read statusCode from EnsoHttpResponse
JaroslavTulach Jun 20, 2024
a1bff6e
Test is accessing IntHolder value and boxed fields
JaroslavTulach Jun 20, 2024
4c2089f
Merging with develop
JaroslavTulach Jun 20, 2024
c4fb3db
Re-adding @Tail_Call as #9251 is fixed
JaroslavTulach Jun 20, 2024
31a3de8
test/Base_Tests shall be executed with assertions enabled
JaroslavTulach Jun 20, 2024
b2caa90
HTTP Response is using a lot of Java classes
JaroslavTulach Jun 20, 2024
1bae374
polyglot java import JsonLocation to be able to extract line and colu…
JaroslavTulach Jun 20, 2024
562e611
Factorial sample program is no longer needed
JaroslavTulach Jun 20, 2024
b8b4aae
Removing unused variables
JaroslavTulach Jun 20, 2024
8d0684c
Including Input_Stream_Spec in the Base_Tests
JaroslavTulach Jun 20, 2024
bfa60b4
Testing InputStreamLike with and without available member
JaroslavTulach Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"request": "launch",
"name": "Launch Native Image",
"nativeImagePath": "${workspaceFolder}/runner",
"args": "--help"
"args": "--run ${file}"
}
]
}
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2610,6 +2610,7 @@ lazy val `engine-runner` = project
additionalOptions = Seq(
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
"-H:IncludeResources=.*Main.enso$",
"-H:+IncludeAllLocales",
// useful perf & debug switches:
// "-g",
// "-H:+SourceLevelDebug",
Expand Down
2 changes: 1 addition & 1 deletion build/build/src/engine/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ pub async fn runner_sanity_test(
);
if enso_java.is_none() {
let test_base = Command::new(&repo_root.runner)
.args(["--run", repo_root.test.join("Base_Tests").as_str(), "^Text"])
.args(["--run", repo_root.test.join("Base_Tests").as_str()])
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
.set_env_opt(ENSO_JAVA, enso_java)?
.set_env(ENSO_DATA_DIRECTORY, engine_package)?
.run_stdout()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import project.Errors.Encoding_Error.Encoding_Error
from project.Data.Text.Extensions import all

polyglot java import java.util.Base64
polyglot java import java.util.Base64.Decoder
polyglot java import java.util.Base64.Encoder

## A helper utility for handling base64 encoding.
type Base_64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import project.Nothing.Nothing
import project.Panic.Panic

polyglot java import org.enso.base.statistics.FitError
polyglot java import org.enso.base.statistics.LinearModel
polyglot java import org.enso.base.statistics.Regression

type Model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ Text.replace self term:(Text | Regex) replacement:Text (case_sensitivity:Case_Se
Applies the specified cleansings to the text.

Arguments:
- remove: A vector of the named patterns to cleanse from the text. The named patterns are
- remove: A vector of the named patterns to cleanse from the text. The named patterns are
applied in the order they are provided. The same named pattern can be used multiple
times. The named patterns are:
- ..Leading_Whitespace: Removes all whitespace from the start of the string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ polyglot java import java.time.DateTimeException
polyglot java import java.time.temporal.ChronoField
polyglot java import java.time.temporal.IsoFields
polyglot java import org.enso.base.Time_Utils
polyglot java import org.enso.base.Time_Utils.AdjustOp

## PRIVATE
Constructs a new Date from a year, month, and day.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ polyglot java import java.time.temporal.TemporalAdjuster
polyglot java import java.time.temporal.TemporalAdjusters
polyglot java import java.time.temporal.TemporalUnit
polyglot java import org.enso.base.time.CustomTemporalUnits
polyglot java import org.enso.base.time.Date_Utils
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these imports also be kept in Extra_Imports.enso?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My decision making process was:

  • if the failure is in *_Spec.enso file, put the polyglot java import into Extra_Imports.enso
  • if the failure is in Standard.Base library file, put the import into that file.

In this case the failure was in Date_Period.enso file, I believe.

polyglot java import org.enso.base.time.Date_Period_Utils
polyglot java import org.enso.base.time.Date_Time_Utils
polyglot java import org.enso.base.time.Time_Of_Day_Utils
polyglot java import org.enso.base.Time_Utils

## Represents a unit of time longer on the scale of days (longer than a day).
Expand Down
3 changes: 3 additions & 0 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Data/XML.enso
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ polyglot java import java.io.StringReader
polyglot java import java.lang.Exception as JException
polyglot java import javax.xml.parsers.DocumentBuilder
polyglot java import javax.xml.parsers.DocumentBuilderFactory
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
polyglot java import javax.xml.xpath.XPath
polyglot java import javax.xml.xpath.XPathConstants
polyglot java import javax.xml.xpath.XPathFactory
polyglot java import org.enso.base.XML_Utils
polyglot java import org.w3c.dom.Attr
polyglot java import org.w3c.dom.Document
polyglot java import org.w3c.dom.Element
polyglot java import org.w3c.dom.Node
polyglot java import org.w3c.dom.NodeList
polyglot java import org.w3c.dom.NamedNodeMap
polyglot java import org.w3c.dom.Text as Java_Text
polyglot java import org.xml.sax.InputSource
polyglot java import org.xml.sax.SAXException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ from project.Metadata import make_single_choice

polyglot java import org.enso.base.enso_cloud.EnsoSecretHelper
polyglot java import org.enso.base.enso_cloud.HideableValue
polyglot java import org.enso.base.enso_cloud.HideableValue.PlainValue
polyglot java import org.enso.base.enso_cloud.HideableValue.SecretValue
polyglot java import org.enso.base.enso_cloud.HideableValue.ConcatValues
polyglot java import org.enso.base.enso_cloud.HideableValue.Base64EncodeValue

## A reference to a secret stored in the Enso Cloud.
type Enso_Secret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ slice vector start end = @Builtin_Method "Array_Like_Helpers.slice"
`Map_Error`.
- No_Wrap: The first error is thrown, and is not wrapped in
`Map_Error`.
- Report_Warning: The result for that element is `Nothing`,
- Report_Warning: The result for that element is `Nothing`,
the error is attached as a warning. Currently unimplemented.
- Ignore: The result is `Nothing`, and the error is
ignored.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ polyglot java import org.enso.base.text.CaseFoldedString.Grapheme

# needed by Comparator_Spec:
polyglot java import org.enso.base.ObjectComparator

# often used in tests
polyglot java import java.util.ArrayList
polyglot java import java.util.Map
polyglot java import java.nio.file.Path
polyglot java import java.math.BigInteger
polyglot java import java.time.LocalDate
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ from project.Data.Boolean import Boolean, False, True
from project.Runtime import assert

polyglot java import org.enso.base.encoding.DecodingProblemAggregator
polyglot java import org.enso.base.encoding.DecodingProblem
polyglot java import org.enso.base.encoding.Encoding_Utils
polyglot java import org.enso.base.encoding.ReportingStreamDecoder

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,17 @@ public static PolyglotCallType getPolyglotCallType(
return PolyglotCallType.CONVERT_TO_HASH_MAP;
}

String methodName = symbol.getName();
if (library.isMemberInvocable(self, methodName)) {
return PolyglotCallType.CALL_METHOD;
} else if (library.isMemberReadable(self, methodName)) {
return PolyglotCallType.GET_MEMBER;
} else if (library.isInstantiable(self) && methodName.equals(NEW_NAME)) {
return PolyglotCallType.INSTANTIATE;
try {
String methodName = symbol.getName();
if (library.isMemberInvocable(self, methodName)) {
return PolyglotCallType.CALL_METHOD;
} else if (library.isMemberReadable(self, methodName)) {
return PolyglotCallType.GET_MEMBER;
} else if (library.isInstantiable(self) && methodName.equals(NEW_NAME)) {
return PolyglotCallType.INSTANTIATE;
}
} catch (TypeNotPresentException ex) {
// no call, get or instantiate is possible
}
return PolyglotCallType.NOT_SUPPORTED;
}
Expand Down
24 changes: 13 additions & 11 deletions lib/rust/parser/generate-java/java/org/enso/syntax2/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,28 @@ private static void initializeLibraries() {
name = "libenso_parser.so";
}

File parser = null;
var whereAmI = Parser.class.getProtectionDomain().getCodeSource().getLocation();
File root;
try {
var whereAmI = Parser.class.getProtectionDomain().getCodeSource().getLocation();
var d = new File(whereAmI.toURI()).getParentFile();
root = new File(whereAmI.toURI()).getParentFile();
} catch (URISyntaxException ex) {
root = new File(".").getAbsoluteFile();
}
try {
var d = root;
File path = null;
while (d != null) {
path = new File(d, name);
if (path.exists()) break;
d = d.getParentFile();
}
if (d == null) {
throw new LinkageError(
"Cannot find parser in " + new File(whereAmI.toURI()).getParentFile());
if (d == null || path == null) {
throw new LinkageError("Cannot find parser in " + root);
}
parser = path;
System.load(parser.getAbsolutePath());
} catch (IllegalArgumentException | URISyntaxException | LinkageError e) {
File root = new File(".").getAbsoluteFile();
System.load(path.getAbsolutePath());
} catch (NullPointerException | IllegalArgumentException | LinkageError e) {
if (!searchFromDirToTop(e, root, "target", "rust", "debug", name)) {
throw new IllegalStateException("Cannot load parser from " + parser, e);
throw new IllegalStateException("Cannot load parser from " + whereAmI, e);
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down
Loading