Edit

kc3-lang/angle/src/common/system_utils_unittest_helper.cpp

Branch :

  • Show log

    Commit

  • Author : Shahbaz Youssefi
    Date : 2019-02-25 16:31:57
    Hash : a9f89313
    Message : Reland "Add system util to execute app and retrieve its output" This reverts commit fe14b2e503a5991aeb033836bb4d525508475b52. Reason for revert: failing test is reworked not to run angle_unittests itself, but another binary. Previously, this test was calling angle_unittests itself, but with a different target. On the bots, that was in turn calling angle_unittests with even more arguments, including the addition of a log file location. Under some configurations, this separate process was thus trying to access files that were already opened by the parent process, leading to a test failure. In this CL, a new helper executable is created for the sake of this unittest. > Revert "Add system util to execute app and retrieve its output" > > This reverts commit c63d95525cde8d28963148bb5894456c1d39018d. > > Reason for revert: Test fails on Win7 > > Original change's description: > > Add system util to execute app and retrieve its output > > > > This will be useful to run external applications, such as benchmarks, > > and process their output. > > > > Bug: angleproject:3125 > > Change-Id: Ic13c69f2e034f4b47498fb2f299c62423c355c4a > > Reviewed-on: https://chromium-review.googlesource.com/c/1452534 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Jamie Madill <jmadill@google.com> Bug: angleproject:3125, angleproject:3168 Change-Id: I74815750484a79f33c36e0b4f941d4dd98f99aa5 Reviewed-on: https://chromium-review.googlesource.com/c/1487631 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@google.com> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>

  • src/common/system_utils_unittest_helper.cpp
  • //
    // Copyright 2019 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    
    // system_utils_unittest_helper.cpp: Helper to the SystemUtils.RunApp unittest
    
    #include "common/system_utils_unittest_helper.h"
    #include <string.h>
    #include "common/system_utils.h"
    
    int main(int argc, char **argv)
    {
        if (argc != 3 || strcmp(argv[1], kRunAppTestArg1) != 0 || strcmp(argv[2], kRunAppTestArg2) != 0)
        {
            fprintf(stderr, "Expected command line:\n%s %s %s\n", argv[0], kRunAppTestArg1,
                    kRunAppTestArg2);
            return EXIT_FAILURE;
        }
    
        std::string env = angle::GetEnvironmentVar(kRunAppTestEnvVarName);
        if (env == "")
        {
            printf("%s", kRunAppTestStdout);
            fprintf(stderr, "%s", kRunAppTestStderr);
        }
        else
        {
            fprintf(stderr, "%s", env.c_str());
        }
    
        return EXIT_SUCCESS;
    }