<commit_before>﻿// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using Xunit;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel;

namespace ConsoleApplication
{
    public class E2ETest
    {
        private static readonly string EXPECTED_OUTPUT = "Hello World!" + Environment.NewLine;
        private static readonly string TESTDIR_NAME = "hellotest";
        private static readonly string OUTPUTDIR_NAME = "testbin";

        private static string RootPath { get; set; }
        private string TestDirectory { get; set; }
        private string OutputDirectory { get; set; }
        private string Rid { get; set; }

        public static void Main()
        {
            Console.WriteLine("Dummy Entrypoint.");
        }
       
        public E2ETest()
        {
            if (RootPath == null)
            {
                RootPath = Directory.GetCurrentDirectory();
            }

            TestDirectory = Path.Combine(RootPath, TESTDIR_NAME);
            OutputDirectory = Path.Combine(RootPath, OUTPUTDIR_NAME);

            Rid = RuntimeIdentifier.Current;
        }

        [Fact]
        public void TestDotnetCompile()
        {
            TestSetup();

            TestRunCommand("dotnet", $"compile -o {OutputDirectory}");
            TestOutputExecutable(OutputDirectory);
        }

        [Fact]
        public void TestDotnetCompileNativeRyuJit()
        {
            // Skip this test on mac
            if(SkipForOS(OSPlatform.OSX, "https://github.com/dotnet/cli/issues/246"))
            {
                return;
            }

            TestSetup();

            TestRunCommand("dotnet", $"compile --native -o {OutputDirectory}");

            var nativeOut = Path.Combine(OutputDirectory, "native");
            TestOutputExecutable(nativeOut);
        }

        [Fact]
        public void TestDotnetCompileNativeCpp()
        {
            // Skip this test on windows
            if(SkipForOS(OSPlatform.Windows, "https://github.com/dotnet/cli/issues/335"))<commit_msg>skip ryujit test on ubuntu<commit_after>﻿// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using Xunit;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel;

namespace ConsoleApplication
{
    public class E2ETest
    {
        private static readonly string EXPECTED_OUTPUT = "Hello World!" + Environment.NewLine;
        private static readonly string TESTDIR_NAME = "hellotest";
        private static readonly string OUTPUTDIR_NAME = "testbin";

        private static string RootPath { get; set; }
        private string TestDirectory { get; set; }
        private string OutputDirectory { get; set; }
        private string Rid { get; set; }

        public static void Main()
        {
            Console.WriteLine("Dummy Entrypoint.");
        }
       
        public E2ETest()
        {
            if (RootPath == null)
            {
                RootPath = Directory.GetCurrentDirectory();
            }

            TestDirectory = Path.Combine(RootPath, TESTDIR_NAME);
            OutputDirectory = Path.Combine(RootPath, OUTPUTDIR_NAME);

            Rid = RuntimeIdentifier.Current;
        }

        [Fact]
        public void TestDotnetCompile()
        {
            TestSetup();

            TestRunCommand("dotnet", $"compile -o {OutputDirectory}");
            TestOutputExecutable(OutputDirectory);
        }

        [Fact]
        public void TestDotnetCompileNativeRyuJit()
        {
            // Skip this test on mac
            if(SkipForOS(OSPlatform.OSX, "https://github.com/dotnet/cli/issues/246"))
            {
                return;
            }

            if(SkipForOS(OSPlatform.Linux, "https://github.com/dotnet/cli/issues/527"))
            {
                return;
            }

            TestSetup();

            TestRunCommand("dotnet", $"compile --native -o {OutputDirectory}");

            var nativeOut = Path.Combine(OutputDirectory, "native");
            TestOutputExecutable(nativeOut);
        }

        [Fact]
        public void TestDotnetCompileNativeCpp()
        {
            // Skip this test on windows
            if(SkipForOS(OSPlatform.Windows, "https://github.com/dotnet/cli/issues/335"))
{'fraction_non_alphanumeric': 0.09316638370118846, 'fraction_numerical': 0.004032258064516129, 'mean_word_length': 2.066363044892648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5131958', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1193, 'n_words': 312}