Opened 9 years ago

Closed 9 years ago

Last modified 3 years ago

#3275 closed defect (fixed)

[PATCH] Remove generated test files on cleanup

Reported by: Karamel Owned by: otero
Priority: If Time Permits Milestone: Alpha 19
Component: Build & Packages Keywords: simple patch
Cc: Patch:

Description (last modified by bb)

When compiling sources some auto-generated .cpp test files from cxxtest use absolute path instead of relative to link to the relative .h

If you move the project to an other directory, it doesn't compile anymore. make clean and clean-workspaces.sh don't delete these generated files.

clean-workspaces.sh or make clean should be extended to remove those.

Below is the list of these files

source/scriptinterface/tests/test_ObjectToIDMap.cpp
source/scriptinterface/tests/test_ScriptConversions.cpp
source/scriptinterface/tests/test_ScriptInterface.cpp
source/lib/tests/test_path.cpp
source/lib/tests/test_secure_crt.cpp
source/lib/sysdep/tests/test_sysdep.cpp
source/lib/res/graphics/tests/test_tex.cpp
source/lib/file/vfs/tests/test_vfs_tree.cpp
source/third_party/encryption/tests/test_sha.cpp
source/third_party/encryption/tests/test_pkcs5_pbkdf5.cpp
source/simulation2/tests/test_ComponentManager.cpp
source/simulation2/tests/test_CmpTemplateManager.cpp
source/simulation2/tests/test_Serializer.cpp
source/simulation2/tests/test_Simulation2.cpp
source/simulation2/components/tests/test_Pathfinder.cpp
source/simulation2/components/tests/test_RangeManager.cpp
source/simulation2/components/tests/test_scripts.cpp
source/simulation2/components/tests/test_CommandQueue.cpp
source/simulation2/components/tests/test_ObstructionManager.cpp
source/simulation2/components/tests/test_TerritoryManager.cpp
source/simulation2/components/tests/test_Position.cpp
source/graphics/tests/test_TextureManager.cpp
source/graphics/tests/test_MeshManager.cpp
source/graphics/tests/test_ShaderManager.cpp
source/graphics/tests/test_Terrain.cpp
source/graphics/tests/test_TextureConverter.cpp
source/graphics/tests/test_LOSTexture.cpp
source/maths/tests/test_Brush.cpp
source/ps/tests/test_CColor.cpp
source/ps/tests/test_Preprocessor.cpp
source/ps/tests/test_CLogger.cpp
source/ps/tests/test_cppformat.cpp
source/ps/tests/stub_impl_hack.cpp
source/ps/XML/tests/test_RelaxNG.cpp
source/network/tests/test_NetMessage.cpp
source/network/tests/test_Net.cpp
source/gui/tests/test_ParseString.cpp

I searched in build/workspaces/codeblocks/test.cbp the difference with an other file with relative path but couldn't find it.

Attachments (2)

clean-workspaces-v1.diff (2.7 KB ) - added by otero 9 years ago.
Delete autogenerated test files
clean-workspaces-v2.diff (643 bytes ) - added by otero 9 years ago.
Clean workspaces v2 patch

Download all attachments as: .zip

Change History (11)

comment:1 by leper, 9 years ago

Description: modified (diff)
Keywords: simple added; tests compile removed
Summary: Some generated test files use absolute path to include .hRemove generated test files on cleanup

clean-workspaces.sh should just remove generated test files.

Moving the repository is uncommon enough of a use-case to make this really worth bothering with (as just removing unversioned files fixes the issue).

comment:2 by otero, 9 years ago

Cc: otero_xd@… added
Keywords: review patch added
Milestone: BacklogAlpha 19
Owner: set to otero
Status: newassigned
Summary: Remove generated test files on cleanup[PATCH] Remove generated test files on cleanup

by otero, 9 years ago

Attachment: clean-workspaces-v1.diff added

Delete autogenerated test files

comment:3 by otero, 9 years ago

This patch contemplates more files that are generated at build time which are not mentioned in the list above but are also using absolute path.

In CXXTest 4.1 was introduced as a default configuration to work with absolute paths in header files, understanding this is easier to delete all .cpp files generated during testing creation instead of a specific list of files, it scales better and reduces the final size of the script file.

Patch tested in Linux and Mac system. Update workspaces, Compilation and tests worked correctly after running the new script.

comment:4 by otero, 9 years ago

Cc: otero_xd@… removed

comment:5 by Itms, 9 years ago

Keywords: review removed

Your solution is not flexible at all currently (we don't want to change the script everytime we add a folder containing a test in source/).

Also why do you add those | at the end of the patch?

Thanks for contributing.

by otero, 9 years ago

Attachment: clean-workspaces-v2.diff added

Clean workspaces v2 patch

in reply to:  5 comment:6 by otero, 9 years ago

Keywords: review added

Replying to Itms:

I thought about the flexibility of my first patch and you're right. I fixed in a new version to contemplate current and future test files in the source directory.

About the pipe character (|) I didn't notice it last time. Fixed in this version

Greetings

comment:7 by leper, 9 years ago

Resolution: fixed
Status: assignedclosed

In 16921:

Remove generated test files during clean-workspaces.sh. Patch by otero. Fixes #3275.

Also remove two generated and disabled test files.

comment:8 by leper, 9 years ago

Keywords: review removed

Thanks for the patch and sorry for taking so long to review this.

I left out the comment that wasn't really adding anything and stopped spawning a sub-shell there since we don't need to change directories.

comment:9 by bb, 3 years ago

Description: modified (diff)

In r25871

Remove generated test files, stub_impl_hack on cleanup

At some point make clean should take care of this.

Proposed By: elexis in D256 Approach suggested by: leper Reviewed By: Freagarach Differential Revision: D4219

Note: See TracTickets for help on using tickets.