Skip to content

Commit

Permalink
chore: remove std directory (denoland#9361)
Browse files Browse the repository at this point in the history
This removes the std folder from the tree.

Various parts of the tests are pretty tightly dependent 
on std (47 direct imports and 75 indirect imports, not 
counting the cli tests that use them as fixtures) so I've 
added std as a submodule for now.
  • Loading branch information
caspervonb committed Feb 2, 2021
1 parent a2b5d44 commit 6abf126
Show file tree
Hide file tree
Showing 516 changed files with 82 additions and 72,877 deletions.
5 changes: 1 addition & 4 deletions .dprintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@
"cli/tests/inline_js_source_map*",
"cli/tests/badly_formatted.md",
"cli/tsc/*typescript.js",
"test_util/std",
"test_util/wpt",
"gh-pages",
"std/**/testdata",
"std/**/vendor",
"std/node_modules",
"std/hash/_wasm",
"target",
"third_party",
"tools/wpt/expectation.json",
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ jobs:
startsWith(matrix.os, 'ubuntu') &&
matrix.kind == 'test_release' &&
github.repository == 'denoland/deno' &&
startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/tags/std/')
startsWith(github.ref, 'refs/tags/')
run: |
mkdir -p target/release
tar --exclude=.cargo_home --exclude=".git*" --exclude=target --exclude=third_party/prebuilt -czvf target/release/deno_src.tar.gz -C .. deno
Expand Down Expand Up @@ -112,9 +111,8 @@ jobs:
runner.os != 'Windows' &&
matrix.kind == 'test_release' &&
github.repository == 'denoland/deno' &&
(github.ref == 'refs/heads/master' ||
startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/tags/std/'))
github.ref == 'refs/heads/master' ||
startsWith(github.ref, 'refs/tags/')
uses: google-github-actions/setup-gcloud@master
with:
project_id: denoland
Expand All @@ -126,9 +124,8 @@ jobs:
runner.os == 'Windows' &&
matrix.kind == 'test_release' &&
github.repository == 'denoland/deno' &&
(github.ref == 'refs/heads/master' ||
startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/tags/std/'))
github.ref == 'refs/heads/master' ||
startsWith(github.ref, 'refs/tags/')
uses: google-github-actions/setup-gcloud@master
env:
CLOUDSDK_PYTHON: ${{env.pythonLocation}}\python.exe
Expand Down Expand Up @@ -288,8 +285,7 @@ jobs:
runner.os != 'Windows' &&
matrix.kind == 'test_release' &&
github.repository == 'denoland/deno' &&
startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/tags/std/')
startsWith(github.ref, 'refs/tags/')
run: |
gsutil cp ./target/release/*.zip gs:https://dl.deno.land/release/${GITHUB_REF#refs/*/}/
echo ${GITHUB_REF#refs/*/} > release-latest.txt
Expand All @@ -300,8 +296,7 @@ jobs:
runner.os == 'Windows' &&
matrix.kind == 'test_release' &&
github.repository == 'denoland/deno' &&
startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/tags/std/')
startsWith(github.ref, 'refs/tags/')
env:
CLOUDSDK_PYTHON: ${{env.pythonLocation}}\python.exe
shell: bash
Expand All @@ -315,8 +310,7 @@ jobs:
if: |
matrix.kind == 'test_release' &&
github.repository == 'denoland/deno' &&
startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/tags/std/')
startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
path = third_party
url = https://github.com/denoland/deno_third_party.git
shallow = true
[submodule "std/wasi/testdata"]
path = std/wasi/testdata
url = https://github.com/khronosproject/wasi-test-suite.git
shallow = true
[submodule "test_util/wpt"]
path = test_util/wpt
url = https://github.com/denoland/wpt.git
shallow = true
[submodule "test_util/std"]
path = test_util/std
url = https://github.com/denoland/deno_std
shallow = true
2 changes: 1 addition & 1 deletion cli/bench/deno_http_proxy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
import { serve, ServerRequest } from "../std/http/server.ts";
import { serve, ServerRequest } from "../test_util/std/http/server.ts";

const addr = Deno.args[0] || "127.0.0.1:4500";
const originAddr = Deno.args[1] || "127.0.0.1:4501";
Expand Down
2 changes: 1 addition & 1 deletion cli/bench/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ fn deno_http(deno_exe: &str) -> Result<HttpBenchmarkResult> {
"--allow-net",
"--reload",
"--unstable",
"std/http/bench.ts",
"test_util/std/http/bench.ts",
&server_addr(port),
],
port,
Expand Down
20 changes: 14 additions & 6 deletions cli/bench/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
),
(
"check",
&["cache", "--reload", "std/examples/chat/server_test.ts"],
&[
"cache",
"--reload",
"test_util/std/examples/chat/server_test.ts",
],
None,
),
(
Expand All @@ -88,18 +92,22 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
"cache",
"--reload",
"--no-check",
"std/examples/chat/server_test.ts",
"test_util/std/examples/chat/server_test.ts",
],
None,
),
(
"bundle",
&["bundle", "std/examples/chat/server_test.ts"],
&["bundle", "test_util/std/examples/chat/server_test.ts"],
None,
),
(
"bundle_no_check",
&["bundle", "--no-check", "std/examples/chat/server_test.ts"],
&[
"bundle",
"--no-check",
"test_util/std/examples/chat/server_test.ts",
],
None,
),
];
Expand Down Expand Up @@ -254,8 +262,8 @@ fn get_binary_sizes(target_dir: &PathBuf) -> Result<HashMap<String, u64>> {
}

const BUNDLES: &[(&str, &str)] = &[
("file_server", "./std/http/file_server.ts"),
("gist", "./std/examples/gist.ts"),
("file_server", "./test_util/std/http/file_server.ts"),
("gist", "./test_util/std/examples/gist.ts"),
];
fn bundle_benchmark(deno_exe: &PathBuf) -> Result<HashMap<String, u64>> {
let mut sizes = HashMap::<String, u64>::new();
Expand Down
8 changes: 4 additions & 4 deletions cli/http_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ mod tests {
Some(
read(
test_util::root_path()
.join("std/http/testdata/tls/RootCA.pem")
.join("cli/tests/tls/RootCA.pem")
.to_str()
.unwrap(),
)
Expand Down Expand Up @@ -345,7 +345,7 @@ mod tests {
Some(
read(
test_util::root_path()
.join("std/http/testdata/tls/RootCA.pem")
.join("cli/tests/tls/RootCA.pem")
.to_str()
.unwrap(),
)
Expand Down Expand Up @@ -376,7 +376,7 @@ mod tests {
Some(
read(
test_util::root_path()
.join("std/http/testdata/tls/RootCA.pem")
.join("cli/tests/tls/RootCA.pem")
.to_str()
.unwrap(),
)
Expand Down Expand Up @@ -416,7 +416,7 @@ mod tests {
Some(
read(
test_util::root_path()
.join("std/http/testdata/tls/RootCA.pem")
.join("cli/tests/tls/RootCA.pem")
.to_str()
.unwrap(),
)
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/034_onload/imported.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../../../std/testing/asserts.ts";
import { assert } from "../../../test_util/std/testing/asserts.ts";
import "./nest_imported.ts";

const handler = (e: Event): void => {
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/034_onload/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../../../std/testing/asserts.ts";
import { assert } from "../../../test_util/std/testing/asserts.ts";
import "./imported.ts";

assert(window.hasOwnProperty("onload"));
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/034_onload/nest_imported.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../../../std/testing/asserts.ts";
import { assert } from "../../../test_util/std/testing/asserts.ts";

const handler = (e: Event): void => {
assert(!e.cancelable);
Expand Down
4 changes: 3 additions & 1 deletion cli/tests/045_proxy_client.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
const res = await fetch("http:https://localhost:4545/std/examples/colors.ts");
const res = await fetch(
"http:https://localhost:4545/test_util/std/examples/colors.ts",
);
console.log(`Response http: ${await res.text()}`);
8 changes: 4 additions & 4 deletions cli/tests/045_proxy_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
import { serve, ServerRequest } from "../../std/http/server.ts";
import { assertEquals } from "../../std/testing/asserts.ts";
import { serve, ServerRequest } from "../../test_util/std/http/server.ts";
import { assertEquals } from "../../test_util/std/testing/asserts.ts";

const addr = Deno.args[1] || "127.0.0.1:4555";

Expand Down Expand Up @@ -54,7 +54,7 @@ async function testModuleDownload(): Promise<void> {
"cache",
"--reload",
"--quiet",
"http:https://localhost:4545/std/examples/colors.ts",
"http:https://localhost:4545/test_util/std/examples/colors.ts",
],
stdout: "piped",
env: {
Expand Down Expand Up @@ -96,7 +96,7 @@ async function testModuleDownloadNoProxy(): Promise<void> {
"cache",
"--reload",
"--quiet",
"http:https://localhost:4545/std/examples/colors.ts",
"http:https://localhost:4545/test_util/std/examples/colors.ts",
],
stdout: "piped",
env: {
Expand Down
6 changes: 3 additions & 3 deletions cli/tests/045_proxy_test.ts.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Proxy server listening on [WILDCARD]
Proxy request to: http:https://localhost:4545/std/examples/colors.ts
Proxy request to: http:https://localhost:4545/std/examples/colors.ts
Proxy request to: http:https://localhost:4545/std/fmt/colors.ts
Proxy request to: http:https://localhost:4545/test_util/std/examples/colors.ts
Proxy request to: http:https://localhost:4545/test_util/std/examples/colors.ts
Proxy request to: http:https://localhost:4545/test_util/std/fmt/colors.ts
2 changes: 1 addition & 1 deletion cli/tests/compiler_api_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
assert,
assertEquals,
assertThrowsAsync,
} from "../../std/testing/asserts.ts";
} from "../../test_util/std/testing/asserts.ts";

Deno.test({
name: "Deno.emit() - sources provided",
Expand Down
64 changes: 0 additions & 64 deletions cli/tests/hash.ts

This file was deleted.

38 changes: 1 addition & 37 deletions cli/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,6 @@ use std::process::Command;
use tempfile::TempDir;
use test_util as util;

#[test]
fn std_tests() {
let dir = TempDir::new().expect("tempdir fail");
let status = util::deno_cmd()
.env("DENO_DIR", dir.path())
.current_dir(util::root_path())
.arg("test")
.arg("--unstable")
.arg("--seed=86") // Some tests rely on specific random numbers.
.arg("-A")
// .arg("-Ldebug")
.arg("std/")
.spawn()
.unwrap()
.wait()
.unwrap();
assert!(status.success());
}

#[test]
fn std_lint() {
let status = util::deno_cmd()
.arg("lint")
.arg("--unstable")
.arg(format!(
"--ignore={}",
util::root_path().join("std/node/tests").to_string_lossy()
))
.arg(util::root_path().join("std"))
.spawn()
.unwrap()
.wait()
.unwrap();
assert!(status.success());
}

#[test]
fn js_unit_tests_lint() {
let status = util::deno_cmd()
Expand Down Expand Up @@ -4888,7 +4852,7 @@ console.log("finish");
.arg("--unstable")
.arg("--output")
.arg(&exe)
.arg("./std/examples/welcome.ts")
.arg("./test_util/std/examples/welcome.ts")
.stdout(std::process::Stdio::piped())
.spawn()
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_runner_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.

import { assert } from "../../std/testing/asserts.ts";
import { assert } from "../../test_util/std/testing/asserts.ts";

Deno.test("fail1", function () {
assert(false, "fail1 assertion");
Expand Down
4 changes: 2 additions & 2 deletions cli/tests/unit/blob_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
import { assert, assertEquals, unitTest } from "./test_util.ts";
import { concat } from "../../../std/bytes/mod.ts";
import { decode } from "../../../std/encoding/utf8.ts";
import { concat } from "../../../test_util/std/bytes/mod.ts";
import { decode } from "../../../test_util/std/encoding/utf8.ts";

unitTest(function blobString(): void {
const b1 = new Blob(["Hello World"]);
Expand Down
Loading

0 comments on commit 6abf126

Please sign in to comment.