kola/tests/misc: add a test to find broken symbolic links
This only checks the ROOT and USR partitions for now.
@@ -24,6 +24,12 @@ import (
)
func init() {
+ register.Register(&register.Test{
+ Run: DeadLinks,
+ ClusterSize: 1,
+ Name: "coreos.filesystem.deadlinks",
+ UserData: `#cloud-config`,
+ })
register.Register(&register.Test{
Run: SUIDFiles,
ClusterSize: 1,
@@ -85,6 +91,21 @@ func sugidFiles(m platform.Machine, validfiles []string, mode string) error {
return nil
}
+func DeadLinks(c cluster.TestCluster) error {
+ m := c.Machines()[0]
+
+ output, err := m.SSH(`sudo find / /usr -ignore_readdir_race -xdev -xtype l`)
+ if err != nil {
+ return fmt.Errorf("Failed to run find: output %s, status: %v", output, err)
+ }
+
+ if string(output) != "" {
+ return fmt.Errorf("Dead symbolic links found: %v", strings.Split(string(output), "\n"))
+ }
+
+ return nil
+}
+
func SUIDFiles(c cluster.TestCluster) error {
m := c.Machines()[0]
