-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repo: restructure the repository layout
Restructure the whole repository layout to a more streamlined layout. This commit focuses on the go code. Other code will be considered eventually. The overall structure was discussed in #4076. Each service and cli tools gets a top-level directory. Packages that are shared across multiple applications are grouped in the `private` directory. This should indicate that these packages are not intended to be used by external parties, and that semantic versioning will not apply to these packages. Developer tools are grouped in the `tools` directory. Code that is intended for use by third external parties is grouped in the `pkg` directory. Here we should strive for a stable package API that does not change too often. To smoothen transition, the following gist has all the metadata of the move: https://gist.github.com/oncilla/96bdabb00359fdb4436a7a50d57d3cf3 You can use [go-imports.sh](https://gist.github.com/oncilla/96bdabb00359fdb4436a7a50d57d3cf3#file-go-imports-sh) to fix the imports. [shuffle.yml](https://gist.github.com/oncilla/96bdabb00359fdb4436a7a50d57d3cf3#file-shuffle-yml) lists all the moved packages and their targets. GitOrigin-RevId: 1a49e3871a65a4bbeac515ada78f7208a85d7558
- Loading branch information
Showing
2,431 changed files
with
92,234 additions
and
92,226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
load("//lint:go.bzl", "go_library") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["sigcmn.go"], | ||
importpath = "github.com/scionproto/scion/acceptance", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//pkg/addr:go_default_library", | ||
"//pkg/private/serrors:go_default_library", | ||
"//pkg/snet:go_default_library", | ||
"//tools/integration:go_default_library", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("//lint:go.bzl", "go_library") | ||
load("//:scion.bzl", "scion_go_binary") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["main.go"], | ||
importpath = "github.com/scionproto/scion/acceptance/cmd/sig_ping_acceptance", | ||
visibility = ["//visibility:private"], | ||
deps = [ | ||
"//acceptance:go_default_library", | ||
"//pkg/log:go_default_library", | ||
"//tools/integration:go_default_library", | ||
], | ||
) | ||
|
||
scion_go_binary( | ||
name = "sig_ping_acceptance", | ||
embed = [":go_default_library"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Copyright 2018 ETH Zurich | ||
// Copyright 2020 ETH Zurich, Anapaya Systems | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// The sig_ping acceptance test checks for basic connectivity between AS through the SIG, using | ||
// standard ping. | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
"strconv" | ||
"time" | ||
|
||
"github.com/scionproto/scion/acceptance" | ||
"github.com/scionproto/scion/pkg/log" | ||
"github.com/scionproto/scion/tools/integration" | ||
) | ||
|
||
var ( | ||
name = "sig_ping_acceptance" | ||
cmd = "ping" | ||
attempts = flag.Int("attempts", 5, "Number of ping attempts.") | ||
fail = flag.Bool("fail", false, "Succeed if the pings don't make it through.") | ||
timeoutFlag = flag.Int("timeout", 0, "The timeout that is passed to the ping command") | ||
) | ||
|
||
func main() { | ||
os.Exit(realMain()) | ||
} | ||
|
||
func realMain() int { | ||
if err := integration.Init(); err != nil { | ||
fmt.Fprintf(os.Stderr, "Failed to init: %s\n", err) | ||
return 1 | ||
} | ||
defer log.HandlePanic() | ||
defer log.Flush() | ||
if !*integration.Docker { | ||
log.Error(fmt.Sprintf("Can only run %s test with docker!", name)) | ||
return 1 | ||
} | ||
if err := acceptance.ReadTestingConf(); err != nil { | ||
log.Error("Testing conf reading failed", "err", err) | ||
return 1 | ||
} | ||
|
||
args := []string{cmd, "-c", strconv.Itoa(*attempts), "-O", integration.DstHostReplace} | ||
timeout := time.Duration(*attempts)*2*time.Second + integration.DefaultRunTimeout | ||
if *timeoutFlag != 0 { | ||
args = append(args, "-w", strconv.Itoa(*timeoutFlag)) | ||
timeout = time.Duration(*timeoutFlag)*time.Second + integration.DefaultRunTimeout | ||
} | ||
in := integration.NewBinaryIntegration(name, integration.WrapperCmd, args, nil) | ||
err := integration.RunUnaryTests( | ||
in, | ||
integration.UniqueIAPairs(acceptance.SigAddr), | ||
timeout, | ||
nil, | ||
) | ||
if !*fail && err != nil { | ||
// The pings were supposed to get through but they didn't. | ||
fmt.Fprintf(os.Stderr, "Failed to run tests: %s\n", err) | ||
return 1 | ||
|
||
} | ||
if *fail && err == nil { | ||
fmt.Fprintf(os.Stderr, "Failed to run tests: "+ | ||
"Pings were supposed to not to reach the destination but they did.\n") | ||
return 1 | ||
|
||
} | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.