diff options
Diffstat (limited to 'tests')
10 files changed, 114 insertions, 288 deletions
diff --git a/tests/org.eclipse.swt.tests.cocoa/JUnit Tests/org/eclipse/swt/tests/cocoa/AllCocoaTests.java b/tests/org.eclipse.swt.tests.cocoa/JUnit Tests/org/eclipse/swt/tests/cocoa/AllCocoaTests.java index 193f1a1b0c..0115dffdd6 100644 --- a/tests/org.eclipse.swt.tests.cocoa/JUnit Tests/org/eclipse/swt/tests/cocoa/AllCocoaTests.java +++ b/tests/org.eclipse.swt.tests.cocoa/JUnit Tests/org/eclipse/swt/tests/cocoa/AllCocoaTests.java @@ -1,3 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * Red Hat - initial API and implementation + */ package org.eclipse.swt.tests.cocoa; import org.junit.runner.RunWith; diff --git a/tests/org.eclipse.swt.tests.gtk/JUnit Tests/org/eclipse/swt/tests/gtk/AllGTKTests.java b/tests/org.eclipse.swt.tests.gtk/JUnit Tests/org/eclipse/swt/tests/gtk/AllGTKTests.java index 92cb29294c..73fb65a34f 100644 --- a/tests/org.eclipse.swt.tests.gtk/JUnit Tests/org/eclipse/swt/tests/gtk/AllGTKTests.java +++ b/tests/org.eclipse.swt.tests.gtk/JUnit Tests/org/eclipse/swt/tests/gtk/AllGTKTests.java @@ -1,3 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * Red Hat - initial API and implementation + */ package org.eclipse.swt.tests.gtk; import org.junit.runner.RunWith; diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Table.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Table.java index e9f173a9dd..5e1b9a9a01 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Table.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Table.java @@ -1,3 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * Red Hat - initial API and implementation + */ package org.eclipse.swt.tests.manualJUnit; import java.text.Collator; diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Template.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Template.java index e3b39afdb4..aa9706497e 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Template.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Template.java @@ -1,3 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * Red Hat - initial API and implementation + */ package org.eclipse.swt.tests.manualJUnit; import org.eclipse.swt.SWT; diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java index 362c165c19..29f1d16a4e 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java @@ -1,3 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * Red Hat - initial API and implementation + */ package org.eclipse.swt.tests.manualJUnit; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_curr_working_set.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_curr_working_set.java index 5084dda18a..a2eefbdbc9 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_curr_working_set.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_curr_working_set.java @@ -1,3 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * Red Hat - initial API and implementation + */ package org.eclipse.swt.tests.manualJUnit; import org.junit.FixMethodOrder; diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_root.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_root.java index 6e18831b09..83c3bb44ac 100644 --- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_root.java +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_root.java @@ -1,3 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * Red Hat - initial API and implementation + */ + + package org.eclipse.swt.tests.manualJUnit; import static org.junit.Assert.fail; diff --git a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/AllWin32Tests.java b/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/AllWin32Tests.java index 2fd75b184e..411fe41953 100644 --- a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/AllWin32Tests.java +++ b/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/AllWin32Tests.java @@ -1,3 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * Red Hat - initial API and implementation + */ package org.eclipse.swt.tests.win32; import org.junit.runner.RunWith; diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/CmdLineInterface.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/CmdLineInterface.java deleted file mode 100644 index ec1d4f50eb..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/CmdLineInterface.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.eclipse.swt.tests.junit; - -import org.junit.runner.JUnitCore; -import org.junit.runner.Result; -import org.junit.runner.notification.Failure; - - -/** - * This java file is intended to be used with the bash script "gtk_version_tests.sh" normally found in: - * ~/git/eclipse.platform.swt/tests/org.eclipse.swt.tests/ - * - * To run this from the command line: - * 1) Ensure 'junit' package is installed on your system. (ex: sudo dnf install junit junit-javadoc) - * 2) Run via: (Assuming your eclipse git repositories are in $HOME/git) -REPO=$HOME/git -ARG=AllNonBrowserTests -java -Djava.library.path=$REPO/eclipse.platform.swt.binaries/bundles/org.eclipse.swt.gtk.linux.x86_64 -Dfile.encoding=UTF-8 -classpath /usr/share/java/junit.jar:/usr/share/java/hamcrest/core.jar:$REPO/eclipse.platform.swt/bundles/org.eclipse.swt/bin:$REPO/eclipse.platform.swt/tests/org.eclipse.swt.tests/bin org.eclipse.swt.tests.junit.CmdLineInterface $ARG - - * TODO someday: generalize this so that any class#method can be ran: - * http://stackoverflow.com/questions/9288107/run-single-test-from-a-junit-class-using-command-line - * - * It is intended to run SWT JUnit tests on multiple GTK versions in batch. Ex GTK2.24, GTK3.14 GTK3.16 etc.. - * This is convenient for patch submissions/reviews. - * - * For more details, see: https://wiki.eclipse.org/SWT/Devel/Gtk/JUnitTests#Running_jUnit_tests_across_multiple_versions_of_GTK - * - * @author For questions/bug reports: Leo Ufimtsev lufimtse@redhat.com, 2016. - */ -public class CmdLineInterface { - - public static void main(String[] args) { - - Result result = null; - - result = runTests(args, result); - - printResults(result); - } - - private static Result runTests(String[] args, Result result) { - if (args[0].equals("AllNonBrowserTests")) { - result = JUnitCore.runClasses(AllNonBrowserTests.class); - } else { - System.out.println("ERROR: Incorrect paramaters were given. See file. ex: AllNonBrowserTests"); - } - return result; - } - - private static void printResults(Result result) { - System.out.println(" ~~ SUMMARY ~~"); - - String gtkVersion = System.getProperty("org.eclipse.swt.internal.gtk.version"); - - if (result.wasSuccessful()) { - System.out.println(" " + gtkVersion + " GTK_TEST_RESULT : ALL TESTS PASS"); - } else { - System.out.println(" " + gtkVersion + " GTK_TEST_RESULT : SOME TESTS FAIL: " + result.getFailureCount() + " / " + result.getRunCount()); - int i = 1; - for (Failure failure : result.getFailures()) { - System.out.print(" " + i + ": "); - System.out.println(failure.toString()); - i++; - } - } - System.out.println(""); - } - - - - -} diff --git a/tests/org.eclipse.swt.tests/gtk_version_tests.sh b/tests/org.eclipse.swt.tests/gtk_version_tests.sh deleted file mode 100755 index 39daa6c823..0000000000 --- a/tests/org.eclipse.swt.tests/gtk_version_tests.sh +++ /dev/null @@ -1,217 +0,0 @@ -#!/bin/bash -version=2 - -############## DOCUMENTATION -### ABOUT -# About this script: -# The purpose of this script is to run SWT JUnit tests with multiple versions of GTK. 2.24, 3.14, 3.16, etc.. -# Then produce an accumilated output that shows which tests fail in which versions of GTK. -# This is particularly useful for patch submissions/reviews. -# Note, the compiled GTK SO files are an external resource. See below. - -### Support and feature requests. -# Leo Ufimtsev: lufimtse@redhat.com 2016 -# You can also create bug in bugzilla for Platform -> SWT with [autotester] in subject. - - -### SETUP -# (Pre-requisite): -# 0) This script assumes that you checked out SWT's sources repo into the default ~/git/ folder. -# If this is not the case, adjust config below. -# -# 1) JUnit setup: -# JUnit and Hamcrest packages are needed for junit to work from the command line. -# I.e, these have to be installed on your system (Eclipse uses it's own jar bundles) -# Hamcrest usually comes with newer versions of JUnit as dependency. -# ex on Fedora: sudo dnf install junit -# -# 2) GTK BUILDS: -# The compiled gtk .so files are readily provided in git repo: -# https://pagure.io/swt_dev_tools -# You can simply clone the repo into: ~/git/ and you're good to go. I.e: -# mkdir ~/git/ -# cd ~/git -# git clone https://pagure.io/swt_dev_tools.git -# -# -# 3) (Optional) Adding more GTK builds. -# I (Leo) usually add new builds to the repo. You just need to pull from time to time. -# However, if you want to do some yourself: -# Checkout and compile some GTK build, business as usual. Then navigate into ~/git/gtk and search for all '.so' files via: -# find . | grep "\.so" -# You only need the '.so' files for the tests, so copy them across to the gtk builds: -# cp $(find . | grep "\.so") ~/git/swt_dev_tools/gtk_builds/3.18.9/ -# (You need to create 3.xx.yy folder first) -# -# -### COMMAND LINE ARGUMENTS -# -n : test with _native gtk. I.e, use the gtk on your system. This is particularly useful if you run this with JHbuild. -# Note, -a and -t are not compatible with each other, but '-n' can be used alongside either one of them. - -# -a : test with _all gtk builds in swt_dev_tools/gtk_builds/. -# -t "3.20 3.18 3.16 3.08 2.24" : _test with certain versions of gtk. Please note: -# * Version must match _exact_ folder names found in swt_dev_tools/gtk_builds/. -# i.e, '3.08' and not '3.8', and not '3.8.6' -# * Also note that the list must be inside quotes. I.e -# -t "3.20 3.18" >> will work, but -# -t 3.20 3.18 >> will only run the first one. -# -### Examples: -# navigate to script directory & execute: -# cd ~/git/eclipse.platform.swt/tests/org.eclipse.swt.tests -# ./gtk_version_tests.sh -t "3.20 3.12" #run certain gtk versions -# ./gtk_version_tests.sh -nt "3.20 3.12" #run native gtk and certain gtk versions -# ./gtk_version_tests.sh -a #run all gtk versions in gtk_builds -# ./gtk_version_tests.sh -na #run natives and all gtk versions in gtk_builds -# -### Return values -# 0 if all tests pass on all GTK versions -# 1 on some error -# 2 if no arguments were given. -# -# More documentation: -# see: https://wiki.eclipse.org/SWT/Devel/Gtk/JUnitTests - - - - -############## CONFIGURATION -# SWT source and binary git repo locations: -# script assumes that swt source (git) and swt_dev repos are in the default: $HOME/git/... but you can change it: -REPO=$HOME/git - -# Location of your gtk_builds. Only change this if you use your own build folder. The build folder should contain just the 'so' files. -GTK_BUILD_DIR=$HOME/git/swt_dev_tools/gtk_builds - -LOG_FILE=gtk_test_out.log -LOG_ERROR_FILE=gtk_test_error.log -#### CONFIG END - - -###################################### CONFIG AND DOCUMENTATION END. Below be dragons - -# Script intro: -echo "#################################################" -echo "# Running SWT jUnit tests. This may take a while." -echo "# Warnings redirected to gtk_test_error.log." -echo "# Copy of output in gtk_test_out.log" -echo "# Script version: $version" -echo "#################################################" - -# Clean up from Previous runs: -rm -f $LOG_ERROR_FILE -rm -f $LOG_FILE # Duplicate output into this file for parsing later. - -################# FUNCTIONS -# Helper functions -func_run_junit () { - # $1 = SWT tests to run. Ex AllNonBrowserTests - - java -Djava.library.path=$REPO/eclipse.platform.swt.binaries/bundles/org.eclipse.swt.gtk.linux.x86_64 \ - -Dfile.encoding=UTF-8 \ - -classpath /usr/share/java/junit.jar:/usr/share/java/hamcrest/core.jar:$REPO/eclipse.platform.swt/bundles/org.eclipse.swt/bin:$REPO/eclipse.platform.swt/tests/org.eclipse.swt.tests/bin org.eclipse.swt.tests.junit.CmdLineInterface $1 2>> $LOG_ERROR_FILE | tee -a $LOG_FILE -} - - -func_run_tests () { - # -m Message to be logged - # -p gtk version in the repo. ex 3.12. This represents the folder the 'so' files are in. - # -t tests to be passed to java command line handler. (additional tests need to be added to java file manually). - # NOTE: '-t' need to be passed in last. - local OPTIND - while getopts "m:p:t:" opt; do - case $opt in - m) #message to be logged. - (>&2 echo "$OPTARG") 2>> $LOG_ERROR_FILE - echo "$OPTARG" | tee -a $LOG_FILE - ;; - p) # set LD_LIBRARY_PATH - export LD_LIBRARY_PATH=$GTK_BUILD_DIR/$OPTARG - ;; - t) - func_run_junit "$OPTARG" - ;; - esac - done -} - - -# Handle command line arguments if given. -func_handle_arguments () { - while getopts "t:na" opt; do - case $opt in - t) - GTK_VERSIONS="$OPTARG" - ;; - a) - GTK_VERSIONS=$(ls $GTK_BUILD_DIR | sort -r) # default=all meaning all folders in build folder. Can be overriden via given args. - ;; - n) - TESTNATIVES=true - ;; - \?) - echo "Invalid option: -$OPTARG" - ;; - esac -done -} - - - - -################# LOGIC - -# Initialization -TESTS=AllNonBrowserTests -TESTNATIVES=false #overriden via '-n' paramater -GTK_VERSIONS= - -# Handle input arguments -if [ $# -ne 0 ]; then # more than 1 arg - func_handle_arguments "$@" -else - echo "Error. No command line arguments were given." - echo "Please see content of script for argument list. (ex -a for all tests etc...)" - exit 2 -fi - -# if '-n' was specified, test with native platform. -if [ "$TESTNATIVES" = true ]; then - func_run_tests -m "------ Testing with native GTK libraries on your system" -p "" -t "$TESTS" -fi - - -# run tests for gtk versions: -for i in $GTK_VERSIONS; do - #local PREFIX - PREFIX=${i:0:2} #ex 3. 2. - # case gtk 3 - if [ $PREFIX == "3." ]; then - export SWT_GTK3=1 - elif [ "$PREFIX" == "2." ]; then - export SWT_GTK3=0 - else - echo " Skipping over folder: $i" - continue - fi - MSG="------ Testing with $i ---------------" - func_run_tests -m "$MSG" -p "$i" -t "$TESTS" -done - - -# Post run analysis. -echo "" -echo " ~~SUMMARY OF SUMMARIES:" -cat $LOG_FILE | grep "GTK_TEST_RESULT" -echo "" -echo "To see warnings that were thrown during tests, see: $LOG_ERROR_FILE" - - -# Exit -if [ $(cat gtk_test_out.log | grep "SOME TESTS FAIL" | wc -l) == "0" ]; then - echo "EXIT 0: All went well" - exit 0 -else - echo "EXIT 1: errors occured" - exit 1 -fi
\ No newline at end of file |