1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00
Commit graph

35924 commits

Author SHA1 Message Date
Jonah Graham
3f682d7b00 Update to latest Orbit which means new mockito version
Note that FileBasedErrorParserTests had to change because of some
Tycho incompatibility with JUnit's ParameterizedTest. It works
in the IDE, but not in maven.

The correct fix is to resolve the tycho settings, see Bug 569949
for a previous example. It may also be simply resolved by updating
to Tycho 3.0.0. However I want to get this change in as
at the moment CDT.setup is broken and that is impeding developers.
2022-11-14 16:04:19 -05:00
Mat Booth
1d0c77de2c Correct typographical error in remote console translation 2022-11-12 11:04:20 +00:00
Moritz 'Morty' Strübe
2939007bac
Docker: pull image automatically (#96)
* Bug 566810: Pull Docker image if necessary

Change-Id: I948e3a273ae598efe563b150922a7bc4b696d05c
Signed-off-by: Moritz 'Morty' Strübe <moritz.struebe@mathema.de>

* docker.launcher: Add tests

* Docker: Fix NPE

This NPE was triggered when the docker image was deleted in the
background.

Change-Id: I7fe8f9204a2f60a5d2396bbc2ec67c7ae820a60a
Signed-off-by: Moritz 'Morty' Strübe <moritz.struebe@mathema.de>

* Bug 566810 Allow setting any Docker image

Allow setting any docker image as string in the input field. There is no
verification yet. If the docker image exists, it is set accordingly.

Change-Id: Iec21798cf79206151067d1e2f3a7ec933f1d0b7d
Signed-off-by: Moritz 'Morty' Strübe <moritz.struebe@mathema.de>

* Bug 566810 Remove volumes immediately

As it is now possible to insert any string, the volumes added by the
image, should be removed immediately, too.

Change-Id: I6c843a2b1e551372e0dff22185d6152faecd72f3

Signed-off-by: Moritz 'Morty' Strübe <moritz.struebe@mathema.de>
2022-11-11 18:51:36 -05:00
Jonah Graham
1689f1947c Remove .. folder entry in zip file
This resolve the following exception during the build:


!ENTRY org.eclipse.ui.ide 4 4 2022-11-11 09:45:42.503
!MESSAGE Entry is outside of the target dir: ../
!STACK 0
java.io.IOException: Entry is outside of the target dir: ../
	at org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider.initialize(ZipFileStructureProvider.java:190)
	at org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider.getChildren(ZipFileStructureProvider.java:113)
	at org.eclipse.ui.wizards.datatransfer.ImportOperation.importRecursivelyFrom(ImportOperation.java:781)
	at org.eclipse.ui.wizards.datatransfer.ImportOperation.execute(ImportOperation.java:385)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.lambda$0(WorkspaceModifyOperation.java:110)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2380)
2022-11-11 11:34:37 -05:00
Jonah Graham
448c8745e8 Delete dead code. 2022-11-11 11:34:37 -05:00
Jonah Graham
a27d4a3bb7 Mark for removal API not accessed within CDT (or Embed CDT) 2022-11-11 11:34:37 -05:00
Moritz 'Morty' Strübe
848ce9c10b cleanliness.sh: Exit if stash is needed 2022-11-11 11:34:04 -05:00
Moritz 'Morty' Strübe
76fe5e6e2d Make running code cleanliness less painfull
* Only check for modifications in tracked files
* Tell the user to stash stuff, before running
2022-11-11 10:41:08 -05:00
John Dallaway
fa14e99ff8
Workaround EASE 0.9.0 headless startup issue (#156)
We register org.eclipse.cdt.codan.internal.ui.cxx.Startup with EASE to
avoid triggering bug 580960.
2022-11-10 19:37:21 +00:00
Jonah Graham
1893069eb5 Remove unmaintained LSP and DAP support from CDT
Fixes #139
2022-11-09 19:47:22 -05:00
Jonah Graham
939da0a445 Provide Issue and PR templates
Part of #32
2022-11-09 10:56:55 -05:00
Jonah Graham
611ea03ab0 Update wiki.eclipse links to their new locations
I have not updated links in old N&N pages from before CDT 10.
I have not updated non-CDT links.

Part of #32
2022-11-09 10:56:55 -05:00
Jonah Graham
15ee18e027 Stop synchronizing user guides from Wiki
The primary location for these user guides is now the Git repo in HTML
format.

Part of #32
2022-11-09 10:56:55 -05:00
Jonah Graham
dcea86c4a2 Fix old link to IP log
The new link is where the old link redirected to
2022-11-09 10:56:55 -05:00
Jonah Graham
92c9ed1622 Move https://wiki.eclipse.org/CDT/StandaloneDebugger to GitHub
Part of #32
2022-11-09 10:56:55 -05:00
Jonah Graham
7fa72da36a CDT Calls on hackmd
Part of #32
2022-11-09 10:56:55 -05:00
Jonah Graham
5007c8b337 Increase timeout waiting for stopped event in test
Fixes #119
2022-11-09 08:58:27 -05:00
Jonah Graham
cc67bd3b59 Handle all errors and runtime exceptions that may be thrown
We can fail to regain our lock in other cases than just
operation cancelled exception, so capture all of those
cases to throw an FailedToReAcquireLockException.

Also, fix another finally block that assumes it has the lock.

Fixes #128
2022-11-09 07:10:10 -05:00
Jonah Graham
a3a6682faa Lower build.properties errors to warnings for some projects
Some projects build some of their bin includes with maven
build, so remove the error in those cases.

fixup for 6eaaf714cc
2022-11-07 23:13:26 -05:00
Jonah Graham
9026f53fd5 Remove deprecated binary parsers and supporting code
These binary parsers have been slated for deleting for
a while and are replaced with 64-bit compatible
versions.

Some methods still refereneced the 32-bit variants
and have been updated to the fully functioning
64-bit variant.

The older parser IDs are preserved (forever?) so that
old projects can be opened without needing to do anything.
The IDs now point at the new implementations.

See also Bug 562495
2022-11-07 20:58:25 -05:00
Jonah Graham
14dfefddb5 Add extension point schema for BinaryParserPage
This extension has been in existence since very early days
of CDT, but it never(?) had a schema, so the improvements
done in #136 will now show errors in use of this extension.
2022-11-07 20:58:25 -05:00
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
8c6f501250 Wait until all threads are stopped before continuing test
These tests all had the same mistake, they had 5 x waitForEvent
with the comment "at this point all 5 threads should be stopped"
but there are actually 6 threads (5 spawned ones + main thread).
Most of the time all 6 threads would be stopped in time, but
sometimes one of them wouldn't be stopped, leading to a
"CoreException: Context is running" error in the test

This fixes the ThreadStackFrameSyncTest item

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
f8dee45ba3 Make tests inherit from BaseTestCase or BaseTestCase5
This provides the shared pre/post condition assertions to
help make sure tests are running in a clean environment.

If I had time I would convert all the tests to BaseTestCase5
which is JUnit5, but I only did the tests that had something
wrong with them.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
021c03633a Delete test for CDT 2.x functionality
Rather than update this test, simply delete this test of
ancient functionality

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
71eae6c2d3 Cosmetic changes to unit test
Instead of using assertTrue, but assertEquals we get nice
error messages that show the contents of the collections.

Using assertEquals(List.of() instead of assertArrayEquals(...
because that gives nicer error messages.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
542e8b474e Make sure test does not leave projects around
Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
b3003b7fa7 Convert test to JUnit5
The test "abused" the JUnit3 ability to control test order and
required all tests to run in the given order to work.

Refactored the test to remove all redundant try/catch and
provide a more traditional flow.

Part of #117
2022-11-07 10:04:20 -05:00
Jonah Graham
05322ac206 Convert to JUnit5 and cleanup resources
Also stop catching exceptions and discarding stacktraces

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