1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
Commit graph

14412 commits

Author SHA1 Message Date
Umair Sair
b10979677e Cleaning project fails once the binary is expanded in project explorer on Windows
Steps:
======
1. Create a managed project and build it
2. Expand the built binary available in binary container in project explorer view
3. Now clean the project, clean will fail irrespective of number of tries you do

Reason:
=======
For finding the sources for binary, Elf instance is created and Section.mapSectionData creates MappedByteBuffer of channel which locks the file on Windows until its garbage collected, see following
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4715154

Solution:
=========
Made ISymbolReader AutoCloseable and user is responsible to properly close it. In case of dwarf reader, we remove all the references of ByteBuffer and call gc.
2022-11-07 17:32:17 -05:00
Jonah Graham
571d62d6f9 Stop trying to clear result caches when lock isn't held
The indexer has a feature that allows readers of the index
to read the index in the middle of write operations. This
is done by using a YeildableIndexLock.

The YeildableIndexLock's yield method can be called to
temporarily give up the write lock. However the assumption
in the code was that it would always successfully
reaquire the lock after that.

However, if the indexing was cancelled the lock would
fail to be reaquired. Therefore the code that thinks it
owns the lock no longer owns it. In this case the code
in PDOMWriter.storeSymbolsInIndex's finally block.

Therefore I have added an new exception type to explicitly
identify this use case so the original code can differentiate
between cases where an exception was thrown where the lock
is still held, and cases where the lock is no longer held.

Note that instead of a new exception caught like this:

```java
} catch (FailedToReAcquireLockException e) {
    hasLock = false;
    e.reThrow();
```

I could have done this:

```java
} catch (InterruptedException | OperationCanceledException e) {
    hasLock = false;
    throw e;
```

But it is not obvious that nothing else other than the
acquire can raise an OperationCanceledException because it
is a RuntimeException. By having a new checked exception we
can know for sure that in the finally block we have lost
our lock.

There are no API implications of this change as all the classes
and interfaces are internal to CDT.

Fixes #128
2022-11-07 17:31:56 -05:00
Jonah Graham
1b080ac87e Include the full stack trace in exception message
The format of this error message used to look like:

```java
Expected number (0) of Non-OK status objects in log differs from actual (1).
	Error while parsing /projC_testTripleDownwardV/h3.h. java.lang.reflect.InvocationTargetException

Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.AssertionError: Need to hold a write lock to clear result caches
```

and it was hard to impossible to identify what the cause is.

The hope is that capturing this fuller stack trace into the log
will make it easier to identify the problem.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
7673c856b6 Place each test run in its own project
This helps add some isolation between tests in case background
threads are accessing a project. However I am not sure
this solves any of the actual outstanding flaky tests.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
c650c25b85 Delete settings.xml file at end of test
Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
6ea56953d0 Create temporary files with ResourceHelper so they get cleanedup
Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
23399e83eb Clean up created projects in tearDown
Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
abd81474e6 Add missing abstract keyword to abstract tests
Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
1cdf58a663 Pass exceptions up the stack
Make sure not to lose stack trace when a test fails.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
75e52e4682 Add JUnit5 dependencies
While it may be that the tests don't directly rely
on JUnit5, the IDE requires JUnit5 in the classpath
or else the launch config doesn't work with this error:

Cannot find class 'org.junit.platform.commons.annotation.Testable'
on project build path.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
5cebec6477 There is a new way to mark tests as failing
And by "new" I mean 15 years old.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
9811767b6a Make ASTWriterTester abstract so it doesn't look like a test
JDT thinks this is a test and will run it in the IDE and display
an error. But it is only used to compose other tests, by making
it abstract the IDE won't see it anymore.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
a5b9803e91 Delete test that was never run
This is an ancient (2004) test that does not apply, was never
referenced in the Suites and whose name doesn't match standard
pattern.

It tried to import ancient versions of projects as well, which
would kick off the project converter UI that can't be disabled
from the core plug-in.

All in all, this test adds nothing of value.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
a08198757a Try to catch uncleaned up files earlier
Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
57d7a47f45 Delete projects fully at the end of tests
This code seems to be trying to optimize across tests.
This change isolated each individual test better.
Also removed is a bunch of effectively unused test code.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
e1dea25b40 Convert more of the tests to JUnit5
Some of these tests left behind projects, by chaning them
to extend BaseTestCase5 the resource cleanup happens
and the tests are cleaned up properly

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
73d74a1db6 Remove test for code that is no longer supported
Ideally the code itself should also be deleted from CDT, but
this test is super flaky and I cannot seem to convert it to
JUnit5 so I can properly mark it as flaky. Therefore
the test is now simply gone.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
a9c0153bf7 Better test error messages when workspace is not empty after test
On GHA the error does not really give a good indication of what
went wrong with minimal to no stack traces

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
320bb231c2 Delete contents on disk when cleaning up after test
The resource helper is widely used, but when it deletes
projects, it leaves their contents on disk. Fix this
so that the contents on disk is deleted.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
62179bc863 Clean up projects created during test
Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
68e326120f Convert test to JUnit5 and cleanup projects made during test
Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
61eac9d982 Remove incorrect assumptions of lifecycle of test
Maybe once upon a time this lifecycle did something,
but now in setUp fProject is always null and therefore
the project was never getting deleted as the fProject
that deleteProject saw was different than
the tests.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
858a194b68 Fail test if there are any files left over in the workspace directory
Some tests sort of clean up after themselves, but still leave files
around.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
46e9c97372 Reduce API warning in test
Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
3474f828de Convert pdom tests to JUnit5 format
This will allow, if needed, to mark tests as flaky

Part of #117
2022-11-07 10:04:20 -05:00
Neuromancer42
679535f50a fix omitted parentheses in extended ASM #134 2022-11-07 09:55:18 -05:00
Neuromancer42
90c6b6c0e9 fix omitted parentheses in extended ASM #134 2022-11-07 09:55:18 -05:00
Jonah Graham
b37e9c3812 Delete all the test suites from primary CDT test projects
Having the test suites means that tests run multiple times
when running in the UI. Most suites just ran the tests in
that package, so their value, especially with the transition
to JUnit5 is minimal.

Note that the suites are not used when running build
with Tycho/Maven

Part of #117
2022-11-07 07:53:47 -05:00
Jonah Graham
6eaaf714cc Upgrade build.properties warnings to errors
Warning in build.properties will be errors when they run
in the tycho build, like this:

```
Error:  Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:2.7.5:package-plugin
(default-package-plugin) on project org.eclipse.cdt.core.tests:
/home/runner/work/cdt/cdt/core/org.eclipse.cdt.core.tests/build.properties:
bin.includes value(s) [test.xml] do not match any files. -> [Help 1]
```

So make them errors in the workspace so that the issue is
detected before push.

Some build.properties issues don't affect the build, but
are still indicative of a problem.
2022-11-06 18:29:28 -05:00
Jonah Graham
ac979bd9e1 Fix unhandled event loop exception when binary parser is not in plugin.xml
If a .cproject references a binary parser ID that is not in
the plug-in XML, or in the XML, but marked as private, the
UI cannot display the binary parsers and was raising an
ArrayIndexOutOfBoundsException as below.

This fix rewrites the array handling using collections.


```java
!ENTRY org.eclipse.ui 4 0 2022-11-04 09:44:27.409
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: Index 7 out of bounds for length 7
	at org.eclipse.cdt.ui.newui.BinaryParsTab.updateData(BinaryParsTab.java:253)
	at org.eclipse.cdt.ui.newui.AbstractCPropertyTab.setVisible(AbstractCPropertyTab.java:253)
	at org.eclipse.cdt.ui.newui.BinaryParsTab.setVisible(BinaryParsTab.java:221)
	at org.eclipse.cdt.ui.newui.AbstractCPropertyTab.handleTabEvent(AbstractCPropertyTab.java:630)
	at org.eclipse.cdt.ui.newui.AbstractPage.updateSelectedTab(AbstractPage.java:412)
	at org.eclipse.cdt.ui.newui.AbstractPage$4.widgetSelected(AbstractPage.java:382)
```
2022-11-04 12:02:15 -04:00
Jonah Graham
09e3b5ca29 Execute autoreconf in the same environment as configure and make
Changed the execute to take the cwd to run the command in and
clean up the related code, including some error message
handling and removing some redundant code.

Fixes #125
2022-11-04 08:24:54 -04:00
Jonah Graham
9cc97ac406 Error message if launcher is null when trying to watchProcess
Part of #125
2022-11-04 08:24:54 -04:00
Jonah Graham
1f19cff227 Make missing identifiers and classes in plugin.xml errors
Subsequent commits fix the errors
2022-11-04 08:19:23 -04:00
Jonah Graham
949d46c630 Delete abstract class with no concrete subclasses 2022-10-25 22:56:02 -04:00
Jonah Graham
306708f5cb Remove projects from workspace at test startup
Various tests are not cleaning up properly after
themselves, causing test failures on subsequent
tests. Therefore start each test by deleting
all projects.

In addition, some tests were creating their test
projects in their constructor. As all the constructors
run before all the tests as part of test discovery
it means that projects were being created in
constructor and interfering with other tests
later. With the deleting of all projects in @AfterEach
these tests would have started failing. Therefore,
change these tests to create their projects
and do other initialize tasks in the setUp method.

For older JUnit3 style tests:
This substantially slows down tests as many tests
rely on sharing the project between multiple tests and
recreating those projects on each run is slow.
Therefore this is not applied universally to
all JUnit3 tests.

For tests that are affected, those tests are moved
to JUnit5 base test.

Part of #117
2022-10-25 22:56:02 -04:00
Jonah Graham
23d44d05a4 Restore completion filter after testing preference
On GitHub actions the org.eclipse.cdt.ui.tests.text.contentassist2
tests are running after ProposalFilterPreferencesTest and
ProposalFilterPreferencesTest was changing the default
filter and not restoring it.

Part of #117
2022-10-25 22:56:02 -04:00
Jonah Graham
d345323f49 Fix CDescriptorOldTests.testDescriptorCreation instability
This old test had a race condition. The failing test was trying
to verify that CDTPROJECT_ADDED was received, but if there
was a delay in the startup then another event would come in
later. So for this test use the first received event,
for the remaining tests use the last received event.

Part of #117
2022-10-25 22:56:02 -04:00
Jonah Graham
128de5d6cd Add missing abstract keyword to abstract tests
Part of #117
2022-10-25 22:56:02 -04:00
Jonah Graham
a827d71f52 Add additional diagnostic to error message
It may be that this test fails regularly because
another test is not cleaned up properly.
Make sure there are no unexpected projects in
the workspace.

Part of #117
2022-10-25 22:56:02 -04:00
Jonah Graham
30166dea86 Bump org.eclipse.cdt.core major version
Due to the removal of previous API done in:

- PR #103
- commit 4de9516e97
2022-10-25 22:28:51 -04:00
Mat Booth
4de9516e97 Bug 580314 - Remove deprecated methods from core build
Deprecated methods in CommandLauncher and CBuildConfiguration
are now removed.
2022-10-21 15:38:58 +01:00
Mat Booth
7edb711c7c Fixes launchbar icons looking blurry on hidpi screens
The launchbar way of compositing images for the buttons was preventing
the use of higher quality icons on hidpi dislays, making the launchbar
buttons look blurry or pixelated compared to other toolbar buttons.

Instead we can get a nicer result with a custom widget on which we can
directly draw a button border plus the hidpi version of the icon.

Also included is an attempt at a 2x hammer build button icon, which
should look a bit nicer on hidpi screens.
2022-10-19 08:41:15 +01:00
Jonah Graham
ab3b819156 Remove API tooling from projects that are not part of our release 2022-10-03 12:42:37 -04:00
Jonah Graham
e4e06008af Update to Java 17 as BREE. Fixes #80 2022-10-03 12:42:37 -04:00
Jonah Graham
110ac149c2 [releng] Bump versions for CDT 11.0.0 2022-10-03 12:42:37 -04:00
Jonah Graham
81785221b4 Bug 579666: Make fields private/non-API that were previously marked for removal 2022-09-09 20:18:47 -04:00
Torbjörn Svensson
3af7d50c4a Improve dark theme on Windows
Switch to CTabFolder/CTabItem for newui.
This changeset is a breaking change but on a review of existing
adopters/extenders of CDT no one is actually accessing these fields.

Change-Id: Ic1ef0f242c1d2932726f3a6d4c9df9558312764a
Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
Also-by: Jonah Graham <jonah@kichwacoders.com>
2022-09-09 20:18:47 -04:00
Jonah Graham
93fbce4f2c Bump cdt.ui major version for CDT 11.0 development 2022-09-09 20:18:47 -04:00
Davin McCall
6445ec4890
Bug 580325 - constexpr evaluation of builtins for clrsb, clz (#52)
Adds constexpr evaluation for some additional compiler builtins. This is
probably the last lot few builtins that can reasonably be
constexpr-evaluated in CDT.
2022-08-22 12:18:26 -04:00
githubaf
9ce74a7145
Do not mark "removing unused section" lines as errors (#19)
gcc linker outputs "removing unused section" to stderr when the option "--print-gc-sections" is used. That is fine. 

Eclipse CDT reports all these lines as errors however and the build seems to have failed, which is wrong.
The was a bug report Bug 539927: Do not mark "Removing unused section" lines as errors and a fix
To fix this bug a change was made 2020-12-02 05322656c6
-CDTGNULinkerErrorParser.regex.LdMode=(.*[/\\\\])?ld(\\.exe)?: (mode .*)
+CDTGNULinkerErrorParser.regex.ldInfo=(.*[/\\\\])?ld(\\.exe)?: ((mode|Removing unused section) .*)

That does however not solve problem entirely, as the output of gcc linker is "removing", not "Removing", i.e. the word "removing" starts with a lower-case "r"
To fix that problem both R and r should be accepted.
2022-08-22 11:42:57 -04:00