<commit_before>package main

import "testing"

// Test APPDATA / LOCALAPPDATA folder are not shared between tasks
func TestAppDataNotShared(t *testing.T) {
	setup(t)

	if config.RunTasksAsCurrentUser {
		t.Skip("Not running, since APPDATA does not change when running as current user")
	}

	// Run two tasks in sequence...

	// First task:
	payload1 := GenericWorkerPayload{
		Command: []string{
			// make sure vars are set
			// https://bugzilla.mozilla.org/show_bug.cgi?id=1338602
			`if not defined APPDATA exit /b 68`,
			`if not defined LOCALAPPDATA exit /b 69`,
			"echo hello > %APPDATA%\\hello.txt",
			"echo hello > %LOCALAPPDATA%\\sir.txt",
			`if not exist "%APPDATA%\hello.txt" exit /b 64`,
			`if not exist "%LOCALAPPDATA%\sir.txt" exit /b 65`,
		},
		MaxRunTime: 10,
	}
	td1 := testTask()

	taskID1, myQueue := submitTask(t, td1, payload1)

	// Second task:
	payload2 := GenericWorkerPayload{
		Command: []string{
			// make sure vars are set
			// https://bugzilla.mozilla.org/show_bug.cgi?id=1338602
			`if not defined APPDATA exit /b 70`,
			`if not defined LOCALAPPDATA exit /b 71`,
			// make sure files don't already exist, because we should have
			// fresh folders created
			`if exist "%APPDATA%\hello.txt" exit /b 66`,
			`if exist "%LOCALAPPDATA%\sir.txt" exit /b 67`,
		},
		MaxRunTime: 10,
	}
	td2 := testTask()

	taskID2, _ := submitTask(t, td2, payload2)

	config.NumberOfTasksToRun = 2
	RunUntilTasksComplete()

	// make sure both tasks resolved successfully
	for _, taskID := range []string{taskID1, taskID2} {
		tsr, err := myQueue.Status(taskID)
		if err != nil {
			t.Fatalf("Could not retrieve task status")
		}
		if tsr.Status.State != "completed" {
			t.Fatalf("Was expecting state %q but got %q", "completed", tsr.Status.State)
		}
	}
}

// Test we don't get weird error:
//  c:\mozilla-build\msys\bin\bash.exe: *** CreateFileMappingA, Win32 error 0.  Terminating.
func TestNoCreateFileMappingError(t *testing.T) {
	setup(t)

	payload := GenericWorkerPayload{
		Command: []string{
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
		},
		MaxRunTime: 10,
	}
	td := testTask()

	taskID, myQueue := submitTask(t, td, payload)
	RunUntilTasksComplete()

	// make sure task resolved successfully
	tsr, err := myQueue.Status(taskID)
	if err != nil {
		t.Fatalf("Could not retrieve task status")
	}
	if tsr.Status.State != "completed" {
		t.Fatalf("Was expecting state %q but got %q", "completed", tsr.Status.State)
	}
}
<commit_msg>Give TestNoCreateFileMappingError some more time, since msys bash seems slow on first invocation<commit_after>package main

import "testing"

// Test APPDATA / LOCALAPPDATA folder are not shared between tasks
func TestAppDataNotShared(t *testing.T) {
	setup(t)

	if config.RunTasksAsCurrentUser {
		t.Skip("Not running, since APPDATA does not change when running as current user")
	}

	// Run two tasks in sequence...

	// First task:
	payload1 := GenericWorkerPayload{
		Command: []string{
			// make sure vars are set
			// https://bugzilla.mozilla.org/show_bug.cgi?id=1338602
			`if not defined APPDATA exit /b 68`,
			`if not defined LOCALAPPDATA exit /b 69`,
			"echo hello > %APPDATA%\\hello.txt",
			"echo hello > %LOCALAPPDATA%\\sir.txt",
			`if not exist "%APPDATA%\hello.txt" exit /b 64`,
			`if not exist "%LOCALAPPDATA%\sir.txt" exit /b 65`,
		},
		MaxRunTime: 10,
	}
	td1 := testTask()

	taskID1, myQueue := submitTask(t, td1, payload1)

	// Second task:
	payload2 := GenericWorkerPayload{
		Command: []string{
			// make sure vars are set
			// https://bugzilla.mozilla.org/show_bug.cgi?id=1338602
			`if not defined APPDATA exit /b 70`,
			`if not defined LOCALAPPDATA exit /b 71`,
			// make sure files don't already exist, because we should have
			// fresh folders created
			`if exist "%APPDATA%\hello.txt" exit /b 66`,
			`if exist "%LOCALAPPDATA%\sir.txt" exit /b 67`,
		},
		MaxRunTime: 10,
	}
	td2 := testTask()

	taskID2, _ := submitTask(t, td2, payload2)

	config.NumberOfTasksToRun = 2
	RunUntilTasksComplete()

	// make sure both tasks resolved successfully
	for _, taskID := range []string{taskID1, taskID2} {
		tsr, err := myQueue.Status(taskID)
		if err != nil {
			t.Fatalf("Could not retrieve task status")
		}
		if tsr.Status.State != "completed" {
			t.Fatalf("Was expecting state %q but got %q", "completed", tsr.Status.State)
		}
	}
}

// Test we don't get weird error:
//  c:\mozilla-build\msys\bin\bash.exe: *** CreateFileMappingA, Win32 error 0.  Terminating.
func TestNoCreateFileMappingError(t *testing.T) {
	setup(t)

	payload := GenericWorkerPayload{
		// run several bash commands, as running one is horribly slow, but
		// let's make sure if you run a lot of them, they are not all slow -
		// hopefully just the first one is the problem
		Command: []string{
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
			`c:\mozilla-build\msys\bin\bash.exe -c "echo hello"`,
		},
		MaxRunTime: 120,
	}
	td := testTask()

	taskID, myQueue := submitTask(t, td, payload)
	RunUntilTasksComplete()

	// make sure task resolved successfully
	tsr, err := myQueue.Status(taskID)
	if err != nil {
		t.Fatalf("Could not retrieve task status")
	}
	if tsr.Status.State != "completed" {
		t.Fatalf("Was expecting state %q but got %q", "completed", tsr.Status.State)
	}
}

{'fraction_non_alphanumeric': 0.14429989729544676, 'fraction_numerical': 0.01797329681615885, 'mean_word_length': 3.4603053435114504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '6571822', 'n_tokens_mistral': 2360, 'n_tokens_neox': 2060, 'n_words': 588}