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

Remove duplicate tests #4266

Conversation

ArkaprabhaChakraborty
Copy link
Contributor

Resolves #4232

Snippet used

import xml.etree.ElementTree as ET

def remove_duplicate_test_tags(xml_file):
    tree = ET.parse(xml_file)
    root = tree.getroot()
    test_case_names = []
    for test in root.findall('test'):
        test_case_name = test.find('testCaseName').text
        if test_case_name in test_case_names:
            root.remove(test)
        else:
            test_case_names.append(test_case_name)
    head_strings = '''<?xml version='1.0' encoding='UTF-8'?>
<!--
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-->
'''
    #add head strings to the xml file
    tree.write(xml_file)
    with open(xml_file, 'r+') as f:
        content = f.read()
        f.seek(0, 0)
        f.write(head_strings)
        f.write(content)

if __name__ == '__main__':
    remove_duplicate_test_tags('playlist.xml')

Signed-off-by: ArkaprabhaChakraborty chakrabortyarkaprabha998@gmail.com

Signed-off-by: ArkaprabhaChakraborty <chakrabortyarkaprabha998@gmail.com>
Copy link
Contributor

@llxia llxia left a comment

Choose a reason for hiding this comment

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

Thanks @ArkaprabhaChakraborty . Nice script!
Do you mind checking the script at https://github.com/adoptium/TKG/tree/master/scripts?

@ArkaprabhaChakraborty
Copy link
Contributor Author

Check which one? :)

Copy link
Contributor

@smlambert smlambert left a comment

Choose a reason for hiding this comment

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

@smlambert smlambert merged commit cbe2d24 into adoptium:master Jan 23, 2023
@ArkaprabhaChakraborty
Copy link
Contributor Author

Wait wait wait you didn't tell me which script????? :)

@smlambert
Copy link
Contributor

The one you mention in #4266 (comment)

@ArkaprabhaChakraborty
Copy link
Contributor Author

Oh you mean I add it to the scripts dir?

@llxia
Copy link
Contributor

llxia commented Jan 23, 2023

you mean I add it to the scripts dir?

Yes, please add the script to https://github.com/adoptium/TKG/tree/master/scripts. See the issue that Shelley opened adoptium/TKG#392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicated test targets in jcstress
3 participants