haikuwebkit/Tools/TestRunnerShared/TestCommand.h

49 lines
1.8 KiB
C
Raw Permalink Normal View History

Share TestFeatures and TestCommand infrastructure between DumpRenderTree and WebKitTestRunner https://bugs.webkit.org/show_bug.cgi?id=217614 Reviewed by Dean Jackson. Move TestFeatures and TestCommand code from WebKitTestRunner to TestRunnerShared and adopt shared code in both WebKitTestRunner and DumpRenderTree. This allows us to remove duplicate argument and test header parsing code and avoid updating both when we want want change things. To support different sets of test header options, featureDefaultsFromTestHeaderForTest now has a parameter for a key type map, rather than the old hardcoded set. This allows WebKitTestRunner and DumpRenderTree, which currently have slightly different options to continue to behave in the same way. Eventually, it will probably make sense to have these mostly generated from the WebPreferences*.yaml configuration files. Matching precedent, shared files use the WTR namespace. * DumpRenderTree/CMakeLists.txt: * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: * TestRunnerShared/CMakeLists.txt: * WebKitTestRunner/CMakeLists.txt: * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Add new files. * DumpRenderTree/DumpRenderTree.h: Removes TestCommand and parseInputLine now that they come from shared TestCommand.h * DumpRenderTree/DumpRenderTreeCommon.cpp: Removed. Moved contents to shared TestCommand.cpp * DumpRenderTree/TestOptions.cpp: * DumpRenderTree/TestOptions.h: Adopt model from WebKitTestRunner and use initialization from TestFeatures. * DumpRenderTree/mac/DumpRenderTree.mm: Adopt shared TestFeatures and TestCommand infrastructure. Construct TestOptions in a similar manner to WebKitTestRunner by merging together hardcoded / path based features and test header based features. * DumpRenderTree/mac/UIDelegate.h: * DumpRenderTree/mac/UIDelegate.mm: Update for new namespace. * TestRunnerShared/TestCommand.cpp: Added. * TestRunnerShared/TestCommand.h: Added. * TestRunnerShared/TestFeatures.cpp: Added. * TestRunnerShared/TestFeatures.h: Added. * WebKitTestRunner/TestController.cpp: * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestOptions.cpp: * WebKitTestRunner/TestOptions.h: Moved from WebKitTestRunner. Generalized to TestFeatures to take a key type map, rather than hard coding it. Replace use of WebKit types, like WKURLRef, with std::string and std::filesystem::path. Canonical link: https://commits.webkit.org/230379@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-12 21:54:50 +00:00
/*
* Copyright (C) 2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <string>
#include <wtf/Seconds.h>
#include <wtf/StdFilesystem.h>
namespace WTR {
struct TestCommand {
std::string pathOrURL;
std::filesystem::path absolutePath;
std::string expectedPixelHash;
WTF::Seconds timeout;
bool shouldDumpPixels { false };
bool dumpJSConsoleLogInStdErr { false };
};
TestCommand parseInputLine(const std::string& inputLine);
std::filesystem::path testPath(const std::string& pathOrURL);
std::string testURLString(const std::string& pathOrURL);
}