osbuild: introduce zipl stage

zipl is a z initial program loader used with IBM Z systems. This stage
is required to get support for the s390x architecture.
This commit is contained in:
Martin Sehnoutka 2020-06-05 13:55:27 +02:00 committed by Tom Gundersen
parent c8666061f0
commit d74fc4e3fa
2 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,25 @@
package osbuild
// The ZiplStageOptions describe how to create zipl stage
//
// The only configuration option available is a boot timeout and it is optional
type ZiplStageOptions struct {
Timeout int `json:"timeout,omitempty"`
}
func (ZiplStageOptions) isStageOptions() {}
// NewZiplStageOptions creates a new ZiplStageOptions object with no timeout
func NewZiplStageOptions() *ZiplStageOptions {
return &ZiplStageOptions{
Timeout: 0,
}
}
// NewZiplStage creates a new zipl Stage object.
func NewZiplStage(options *ZiplStageOptions) *Stage {
return &Stage{
Name: "org.osbuild.zipl",
Options: options,
}
}

View file

@ -0,0 +1,24 @@
package osbuild
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewZiplStageOptions(t *testing.T) {
expectedOptions := &ZiplStageOptions{
Timeout: 0,
}
actualOptions := NewZiplStageOptions()
assert.Equal(t, expectedOptions, actualOptions)
}
func TestNewZiplStage(t *testing.T) {
expectedStage := &Stage{
Name: "org.osbuild.zipl",
Options: &ZiplStageOptions{},
}
actualStage := NewZiplStage(&ZiplStageOptions{})
assert.Equal(t, expectedStage, actualStage)
}